[OpenSER-Devel] [ openser-Bugs-1855861 ] Possible memleak in pseudo variables code

SourceForge.net noreply at sourceforge.net
Fri Dec 28 12:54:49 UTC 2007


Bugs item #1855861, was opened at 2007-12-21 19:31
Message generated for change (Comment added) made by dan_pascu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1855861&group_id=139143

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: core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dan (dan_pascu)
Assigned to: Nobody/Anonymous (nobody)
Summary: Possible memleak in pseudo variables code

Initial Comment:
The functions pv_parse_hdr_name, pv_parse_avp_name and pv_parse_index allocate a nsp variable and after that call pv_parse_spec. If pv_parse_spec is not successful, the functions return without freeing nsp. I'm not sure if pv_parse_spec retains a reference to nsp, but if not there is clearly a mem leak.


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

>Comment By: Dan (dan_pascu)
Date: 2007-12-28 14:54

Message:
Logged In: YES 
user_id=1296758
Originator: YES

I think we all know how a fix should look if it was to be applied. My
question was more about the pertinence of such a fix. This is why I think
that someone with in depth knowledge of the code should take a look and
check if it is not retained somewhere else and still needed even after
those functions return an error.


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

Comment By: Salahuddin Ahmed (rubel001)
Date: 2007-12-23 10:57

Message:
Logged In: YES 
user_id=1953307
Originator: NO

Possible solution of this memleak:
patch:
===========================================================
--- pvar.c      2007-12-17 16:41:29.000000000 +0600
+++ pvar_my_patch.c     2007-12-23 14:12:01.000000000 +0600
@@ -2225,6 +2225,7 @@
                if(p==NULL)
                {
                        LM_ERR("invalid name [%.*s]\n", in->len, in->s);
+                       pkg_free(nsp);
                        return -1;
                }
                //LM_ERR("dynamic name [%.*s]\n", in->len, in->s);
@@ -2286,6 +2287,7 @@
                if(s==NULL)
                {
                        LM_ERR("invalid name [%.*s]\n", in->len, in->s);
+                       pkg_free(nsp);
                        return -1;
                }
                //LM_ERR("dynamic name [%.*s]\n", in->len, in->s);
@@ -2327,6 +2329,7 @@
                if(s==NULL)
                {
                        LM_ERR("invalid index [%.*s]\n", in->len, in->s);
+                       pkg_free(nsp);
                        return -1;
                }
                sp->pvp.pvi.type = PV_IDX_PVAR;
===========================================================

Regards,
bd [dot] rubel [at] gmail [dot] com


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1855861&group_id=139143



More information about the Devel mailing list