[ opensips-Patches-2264067 ] Ambiguous return and possible memory leak

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ opensips-Patches-2264067 ] Ambiguous return and possible memory leak

SourceForge.net
Patches item #2264067, was opened at 2008-11-11 21:02
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2264067&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
>Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Sergio Gutierrez (saguti)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: Ambiguous return and possible memory leak

Initial Comment:
There is an ambiguity in return value within exec module, and a possible memory leak for not adequate memory free.

The patch fixes both.

----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-02-17 17:07

Message:
proved to be invalid.

Thanks and regards,
Bogdan

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2008-11-13 11:07

Message:
Hi Sergio,

> line 136, at exec_str: If pipe cannot be opened, goes to error01, memory
is freed, but return is missed.

There is a return there - the one from error00; the code is set (default)
ret=-1 at the beginning - this is ok here.

> line 160, at exec_str: If there is error reading uri (fgets within
while),goes to error02, which only has return ret;

Yes, and ret is preset to -1; also mem is freed in error01

> line 165, at exec_str: If there is error appending branch, goes to
error02, which only has return ret;

Same as above

> line 172, at exec_str: If message has no from uri, goes to error02,
which onlye has return ret;

Same as above.

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Sergio Gutierrez (saguti)
Date: 2008-11-12 19:32

Message:
Hi Bogdan.

As I see:

line 112, at exec_str: Memory is allocated.
line 136, at exec_str: If pipe cannot be opened, goes to error01, memory
is freed, but return is missed.
line 160, at exec_str: If there is error reading uri (fgets within while),
goes to error02, which only has return ret;
line 165, at exec_str: If there is error appending branch, goes to
error02, which only has return ret;
line 172, at exec_str: If message has no from uri, goes to error02, which
onlye has return ret;

Block defined by error02 does not have memory freeing. Does the program
continue through error01 and error00?

Regards.

Sergio.


----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2008-11-12 19:21

Message:
Hi Sergio,

I do not see the leak - the original code looks safe to me - if there is a
case where you spoted a possible leak, please describe the case (the flow
in the function).

Thanks and regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2264067&group_id=232389

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel