[Devel] Patch: avpops - fix memory leak

John Riordan john at junctionnetworks.com
Mon May 29 02:59:12 CEST 2006


Hi,

Issue: avp_db_query leaks memory.

Patch: Added calls to free the memory.

Thanks,

John
-------------- next part --------------
Index: sip-server/modules/avpops/avpops_db.c
===================================================================
RCS file: /cvsroot/openser/sip-server/modules/avpops/avpops_db.c,v
retrieving revision 1.3
diff -u -r1.3 avpops_db.c
--- sip-server/modules/avpops/avpops_db.c	15 Feb 2006 15:55:52 -0000	1.3
+++ sip-server/modules/avpops/avpops_db.c	29 May 2006 00:52:52 -0000
@@ -342,6 +342,7 @@
 	if(db_res==NULL || RES_ROW_N(db_res)<=0 || RES_COL_N(db_res)<=0)
 	{
 		DBG("avpops:db_query_avp: no result after query\n");
+		db_close_query( db_res );
 		return 1;
 	}
 
@@ -411,6 +412,7 @@
 			if(add_avp(avp_type, avp_name, avp_val)!=0)
 			{
 				LOG(L_ERR,"avpops:db_query_avp: error - unable to add avp\n");
+				db_close_query( db_res );
 				return -1;
 			}
 next_avp:
@@ -423,5 +425,6 @@
 		}
 	}
 
+	db_close_query( db_res );
 	return 0;
 }


More information about the Devel mailing list