[ 
https://issues.apache.org/jira/browse/THRIFT-5094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

wangyunjian updated THRIFT-5094:
--------------------------------
    Attachment: 0001-THRIFT-5094-Fix-memory-leak-in-thrift_server_set_pro.patch

> Fix memory leak in thrift_server_set_property()
> -----------------------------------------------
>
>                 Key: THRIFT-5094
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5094
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Library
>    Affects Versions: 0.13.0
>            Reporter: wangyunjian
>            Priority: Major
>              Labels: patch
>         Attachments: 
> 0001-THRIFT-5094-Fix-memory-leak-in-thrift_server_set_pro.patch
>
>
> The memory leak was triggered on calling thrift_server_set_property().
> Becase the property has been malloced in thrift_simple_server_init().
> So the property need to be freed before setting property.
> Leak:
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7f339c48bae8 in __interceptor_malloc 
> (/usr/lib64/libasan.so.5+0xefae8)
>     #1 0x7f339b4bb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5)
>     #2 0x7f339b4d2e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06)
>     #3 0x7f339b4d344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c)
>     #4 0x7f339bf26849 in g_type_create_instance gtype.c:1848
>     #5 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #6 0x7f339bf0a714 in g_object_new_with_properties 
> (/usr/lib64/libgobject-2.0.so.0+0x17714)
>     #7 0x7f339bf0b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0)
>     #8 0x7f339c1825f2 in thrift_simple_server_init 
> src/thrift/c_glib/server/thrift_simple_server.c:125
>     #9 0x7f339bf268e9 in g_type_create_instance gtype.c:1866
>     #10 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #11 0x7f339bf0af4d in g_object_new_valist 
> (/usr/lib64/libgobject-2.0.so.0+0x17f4d)
>     #12 0x7f339bf0b2ac in g_object_new 
> (/usr/lib64/libgobject-2.0.so.0+0x182ac)
>     #13 0x404045 in main 
> /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:486
>     #14 0x7f339ac9f872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
>     #15 0x402a0d in _start 
> (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/tutorial_server+0x402a0d)
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7f339c48bae8 in __interceptor_malloc 
> (/usr/lib64/libasan.so.5+0xefae8)
>     #1 0x7f339b4bb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5)
>     #2 0x7f339b4d2e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06)
>     #3 0x7f339b4d344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c)
>     #4 0x7f339bf26849 in g_type_create_instance gtype.c:1848
>     #5 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #6 0x7f339bf0a714 in g_object_new_with_properties 
> (/usr/lib64/libgobject-2.0.so.0+0x17714)
>     #7 0x7f339bf0b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0)
>     #8 0x7f339c18266b in thrift_simple_server_init 
> src/thrift/c_glib/server/thrift_simple_server.c:130
>     #9 0x7f339bf268e9 in g_type_create_instance gtype.c:1866
>     #10 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #11 0x7f339bf0af4d in g_object_new_valist 
> (/usr/lib64/libgobject-2.0.so.0+0x17f4d)
>     #12 0x7f339bf0b2ac in g_object_new 
> (/usr/lib64/libgobject-2.0.so.0+0x182ac)
>     #13 0x404045 in main 
> /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:486
>     #14 0x7f339ac9f872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
>     #15 0x402a0d in _start 
> (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/tutorial_server+0x402a0d)
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7f339c48bae8 in __interceptor_malloc 
> (/usr/lib64/libasan.so.5+0xefae8)
>     #1 0x7f339b4bb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5)
>     #2 0x7f339b4d2e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06)
>     #3 0x7f339b4d344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c)
>     #4 0x7f339bf26849 in g_type_create_instance gtype.c:1848
>     #5 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #6 0x7f339bf0a714 in g_object_new_with_properties 
> (/usr/lib64/libgobject-2.0.so.0+0x17714)
>     #7 0x7f339bf0b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0)
>     #8 0x7f339c1826e4 in thrift_simple_server_init 
> src/thrift/c_glib/server/thrift_simple_server.c:135
>     #9 0x7f339bf268e9 in g_type_create_instance gtype.c:1866
>     #10 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #11 0x7f339bf0af4d in g_object_new_valist 
> (/usr/lib64/libgobject-2.0.so.0+0x17f4d)
>     #12 0x7f339bf0b2ac in g_object_new 
> (/usr/lib64/libgobject-2.0.so.0+0x182ac)
>     #13 0x404045 in main 
> /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:486
>     #14 0x7f339ac9f872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
>     #15 0x402a0d in _start 
> (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/tutorial_server+0x402a0d)
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x7f339c48bae8 in __interceptor_malloc 
> (/usr/lib64/libasan.so.5+0xefae8)
>     #1 0x7f339b4bb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5)
>     #2 0x7f339b4d2e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06)
>     #3 0x7f339b4d344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c)
>     #4 0x7f339bf26849 in g_type_create_instance gtype.c:1848
>     #5 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #6 0x7f339bf0a714 in g_object_new_with_properties 
> (/usr/lib64/libgobject-2.0.so.0+0x17714)
>     #7 0x7f339bf0b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0)
>     #8 0x7f339c182579 in thrift_simple_server_init 
> src/thrift/c_glib/server/thrift_simple_server.c:120
>     #9 0x7f339bf268e9 in g_type_create_instance gtype.c:1866
>     #10 0x7f339bf08fc7 in g_object_new_internal gobject.c:1799
>     #11 0x7f339bf0af4d in g_object_new_valist 
> (/usr/lib64/libgobject-2.0.so.0+0x17f4d)
>     #12 0x7f339bf0b2ac in g_object_new 
> (/usr/lib64/libgobject-2.0.so.0+0x182ac)
>     #13 0x404045 in main 
> /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:486
>     #14 0x7f339ac9f872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
>     #15 0x402a0d in _start 
> (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/tutorial_server+0x402a0d)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to