Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5118

Fix memory leak when the handler method return a exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.13.0
    • 0.14.0
    • C glib - Compiler
    • None
    • Patch

    Description

      When a service method throws a custom exception, the exception hasn't
      been freed. The exception object need to be freed after it is setted to
      the result_struct's property.

      Leak:

      Indirect leak of 19 byte(s) in 1 object(s) allocated from:
      #0 0x7f83ef066ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8)
      #1 0x7f83ee0bb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5)
      #2 0x7f83ee0d4b32 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x6cb32)
      #3 0x40a476 in invalid_operation_set_property gen-c_glib/tutorial_types.c:574
      #4 0x7f83eeb093e4 (/usr/lib64/libgobject-2.0.so.0+0x163e4)
      #5 0x7f83eeb0af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d)
      #6 0x7f83eeb0b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac)
      #7 0x402935 in tutorial_calculator_handler_calculate /mnt/hgfs/share/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:233
      #8 0x404e8a in calculator_handler_calculate gen-c_glib/calculator.c:713
      #9 0x4059c8 in calculator_processor_process_calculate gen-c_glib/calculator.c:1030
      #10 0x405fcf in calculator_processor_dispatch_call gen-c_glib/calculator.c:1197
      #11 0x7f83eed54e53 in thrift_dispatch_processor_process (/usr/lib64/libthrift_c_glib.so.0+0xee53)
      #12 0x7f83eed68d11 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:58
      #13 0x7f83eed67b9a in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108
      #14 0x402ef2 in main /mnt/hgfs/share/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506
      #15 0x7f83ed89f872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872)
      #16 0x40254d in _start (/mnt/hgfs/share/thrift-0.13.0/tutorial/c_glib/.libs/tutorial_server+0x40254d)

      Attachments

        Issue Links

          Activity

            People

              wangyunjian wangyunjian
              wangyunjian wangyunjian
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h