[sr-dev] git:sr_3.0: core: fix memleak in fixup_free*

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Oct 13 20:13:14 CEST 2009


Module: sip-router
Branch: sr_3.0
Commit: af8f3e1536d1415ae757d868ff8cfcbb2578c2f5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=af8f3e1536d1415ae757d868ff8cfcbb2578c2f5

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Oct 13 20:11:25 2009 +0200

core: fix memleak in fixup_free*

fparam_free_contents() (which is what all the fixup_free* call in
sr) did not free the original string (which in sr is kept inside
 the fixed fparam/gparam).
It should have no impact, since at this point nobody seems to use
 any fixup_free* functions.

---

 sr_module.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sr_module.c b/sr_module.c
index 5414529..1df69b7 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -1189,7 +1189,7 @@ void fparam_free_contents(fparam_t* fp)
 		case FPARAM_INT:
 		case FPARAM_STR:
 			/* nothing to do */
-			return;
+			break;
 		case FPARAM_REGEX:
 			if (fp->v.regex){
 				regfree(fp->v.regex);
@@ -1225,6 +1225,10 @@ void fparam_free_contents(fparam_t* fp)
 			}
 			break;
 	}
+	if (fp->orig){
+		pkg_free(fp->orig);
+		fp->orig=0;
+	}
 }
 
 




More information about the sr-dev mailing list