Skip to content
  • Stefano Garzarella's avatar
    b084b420
    block/rbd: fix memory leak in qemu_rbd_co_create_opts() · b084b420
    Stefano Garzarella authored
    
    
    When we allocate 'q_namespace', we forgot to set 'has_q_namespace'
    to true. This can cause several issues, including a memory leak,
    since qapi_free_BlockdevCreateOptions() does not deallocate that
    memory, as reported by valgrind:
    
      13 bytes in 1 blocks are definitely lost in loss record 7 of 96
         at 0x4839809: malloc (vg_replace_malloc.c:307)
         by 0x48CEBB8: g_malloc (in /usr/lib64/libglib-2.0.so.0.6600.8)
         by 0x48E3FE3: g_strdup (in /usr/lib64/libglib-2.0.so.0.6600.8)
         by 0x180010: qemu_rbd_co_create_opts (rbd.c:446)
         by 0x1AE72C: bdrv_create_co_entry (block.c:492)
         by 0x241902: coroutine_trampoline (coroutine-ucontext.c:173)
         by 0x57530AF: ??? (in /usr/lib64/libc-2.32.so)
         by 0x1FFEFFFA6F: ???
    
    Fix setting 'has_q_namespace' to true when we allocate 'q_namespace'.
    
    Fixes: 19ae9ae0 ("block/rbd: Add support for ceph namespaces")
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210329150129.121182-3-sgarzare@redhat.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    b084b420
    block/rbd: fix memory leak in qemu_rbd_co_create_opts()
    Stefano Garzarella authored
    
    
    When we allocate 'q_namespace', we forgot to set 'has_q_namespace'
    to true. This can cause several issues, including a memory leak,
    since qapi_free_BlockdevCreateOptions() does not deallocate that
    memory, as reported by valgrind:
    
      13 bytes in 1 blocks are definitely lost in loss record 7 of 96
         at 0x4839809: malloc (vg_replace_malloc.c:307)
         by 0x48CEBB8: g_malloc (in /usr/lib64/libglib-2.0.so.0.6600.8)
         by 0x48E3FE3: g_strdup (in /usr/lib64/libglib-2.0.so.0.6600.8)
         by 0x180010: qemu_rbd_co_create_opts (rbd.c:446)
         by 0x1AE72C: bdrv_create_co_entry (block.c:492)
         by 0x241902: coroutine_trampoline (coroutine-ucontext.c:173)
         by 0x57530AF: ??? (in /usr/lib64/libc-2.32.so)
         by 0x1FFEFFFA6F: ???
    
    Fix setting 'has_q_namespace' to true when we allocate 'q_namespace'.
    
    Fixes: 19ae9ae0 ("block/rbd: Add support for ceph namespaces")
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210329150129.121182-3-sgarzare@redhat.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading