[Home]

Summary:ASTERISK-19133: Memory leak using asterisk T.38 to/from T.30 gateway
Reporter:Sylvain Rochet (gradator)Labels:
Date Opened:2011-12-28 12:32:12.000-0600Date Closed:2012-01-04 15:47:39.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_fax
Versions:10.0.0 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-24555 Memory leak with T.38 fax and SLINEAR format
Environment:Not relevantAttachments:
Description:It seems there is a memory leak when T.30 to/from T.38 gateway is used, here is what I managed to catch with valgrind:

==4888== 1,247,830 (1,225,360 direct, 22,470 indirect) bytes in 2,312 blocks are definitely lost in loss record 1,119 of 1,119
==4888==    at 0x402328F: calloc (vg_replace_malloc.c:467)
==4888==    by 0x810F84B: ast_frdup (utils.h:495)
==4888==    by 0x8193F60: ast_translate (translate.c:518)
==4888==    by 0x5E6DABE: fax_gateway_framehook (res_fax.c:3034)
==4888==    by 0x8110DD2: framehook_list_push_event (framehook.c:83)
==4888==    by 0x80BDB31: __ast_read (channel.c:3965)
==4888==    by 0x80C0473: ast_generic_bridge (channel.c:4305)
==4888==    by 0x80C131B: ast_channel_bridge (channel.c:7674)
==4888==    by 0x80F3AA9: ast_bridge_call (features.c:4019)
==4888==    by 0x63FC4AB: dial_exec_full (app_dial.c:2829)
==4888==    by 0x63FE061: dial_exec (app_dial.c:2929)
==4888==    by 0x81480FF: pbx_exec (pbx.c:1542)

Sylvain
Comments:By: Matt Jordan (mjordan) 2011-12-30 16:17:52.394-0600

When the output frame callback is called in translate.c, the default translate frameout callback will make a call to ast_frisolate.  If the frame was never malloc'd, ast_frdup is called to duplicate the frame.  This causes a problem in fax_gateway_framehook here:

if (active->readtrans && (f = ast_translate(active->readtrans, f, 1)) == NULL) {
f = &ast_null_frame;
ao2_ref(details, -1);
return f;
}

Which will leak memory in the case outlined above.



By: Sylvain Rochet (gradator) 2012-01-06 12:11:31.421-0600

Just upgraded to SVN-branch-10-r349873, still leaking:

==32386== 216,240 bytes in 408 blocks are possibly lost in loss record 1,104 of 1,106
==32386==    at 0x402328F: calloc (vg_replace_malloc.c:467)
==32386==    by 0x810F4AB: ast_frdup (utils.h:495)
==32386==    by 0x81926D0: ast_translate (translate.c:518)
==32386==    by 0x5A6D903: fax_gateway_framehook (res_fax.c:3049)
==32386==    by 0x8110A32: framehook_list_push_event (framehook.c:83)
==32386==    by 0x80BDB42: __ast_read (channel.c:3967)
==32386==    by 0x80C03A4: ast_generic_bridge (channel.c:4307)
==32386==    by 0x80C124B: ast_channel_bridge (channel.c:7720)
==32386==    by 0x80F3989: ast_bridge_call (features.c:4031)
==32386==    by 0x64394AB: dial_exec_full (app_dial.c:2829)
==32386==    by 0x643B061: dial_exec (app_dial.c:2929)
==32386==    by 0x8147D55: pbx_exec (pbx.c:1551)
==32386==
==32386== 564,980 bytes in 1,066 blocks are indirectly lost in loss record 1,105 of 1,106
==32386==    at 0x402328F: calloc (vg_replace_malloc.c:467)
==32386==    by 0x810F4AB: ast_frdup (utils.h:495)
==32386==    by 0x81926D0: ast_translate (translate.c:518)
==32386==    by 0x5A6D903: fax_gateway_framehook (res_fax.c:3049)
==32386==    by 0x8110A32: framehook_list_push_event (framehook.c:83)
==32386==    by 0x80BDB42: __ast_read (channel.c:3967)
==32386==    by 0x80C03A4: ast_generic_bridge (channel.c:4307)
==32386==    by 0x80C124B: ast_channel_bridge (channel.c:7720)
==32386==    by 0x80F3989: ast_bridge_call (features.c:4031)
==32386==    by 0x64394AB: dial_exec_full (app_dial.c:2829)
==32386==    by 0x643B061: dial_exec (app_dial.c:2929)
==32386==    by 0x8147D55: pbx_exec (pbx.c:1551)
==32386==
==32386== 11,438,270 (10,871,890 direct, 566,380 indirect) bytes in 20,513 blocks are definitely lost in loss record 1,106 of 1,106
==32386==    at 0x402328F: calloc (vg_replace_malloc.c:467)
==32386==    by 0x810F4AB: ast_frdup (utils.h:495)
==32386==    by 0x81926D0: ast_translate (translate.c:518)
==32386==    by 0x5A6D903: fax_gateway_framehook (res_fax.c:3049)
==32386==    by 0x8110A32: framehook_list_push_event (framehook.c:83)
==32386==    by 0x80BDB42: __ast_read (channel.c:3967)
==32386==    by 0x80C03A4: ast_generic_bridge (channel.c:4307)
==32386==    by 0x80C124B: ast_channel_bridge (channel.c:7720)
==32386==    by 0x80F3989: ast_bridge_call (features.c:4031)
==32386==    by 0x64394AB: dial_exec_full (app_dial.c:2829)
==32386==    by 0x643B061: dial_exec (app_dial.c:2929)
==32386==    by 0x8147D55: pbx_exec (pbx.c:1551)