[Opensrf-commits] r1842 - trunk/src/libopensrf (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Nov 4 15:53:25 EST 2009


Author: scottmk
Date: 2009-11-04 15:53:20 -0500 (Wed, 04 Nov 2009)
New Revision: 1842

Modified:
   trunk/src/libopensrf/transport_message.c
Log:
Eliminate a potential (if unlikely) memory leak:  Free a
transport_message.error_type before overlaying it.

M    src/libopensrf/transport_message.c


Modified: trunk/src/libopensrf/transport_message.c
===================================================================
--- trunk/src/libopensrf/transport_message.c	2009-11-04 16:32:10 UTC (rev 1841)
+++ trunk/src/libopensrf/transport_message.c	2009-11-04 20:53:20 UTC (rev 1842)
@@ -495,7 +495,9 @@
 	if( !msg ) return;
 
 	if( type != NULL && *type ) {
-		msg->error_type = safe_malloc( strlen(type)+1);
+		if( msg->error_type )
+			free( msg->error_type );
+		msg->error_type = safe_malloc( strlen(type)+1 );
 		strcpy( msg->error_type, type );
 		msg->error_code = err_code;
 	}



More information about the opensrf-commits mailing list