From 45bad68721d8a76f7ed8d5fbb72784947ee1eba9 Mon Sep 17 00:00:00 2001 From: scottmk Date: Wed, 4 Nov 2009 20:53:20 +0000 Subject: [PATCH] Eliminate a potential (if unlikely) memory leak: Free a transport_message.error_type before overlaying it. M src/libopensrf/transport_message.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1842 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/transport_message.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libopensrf/transport_message.c b/src/libopensrf/transport_message.c index f59c6a4..dfe83d1 100644 --- a/src/libopensrf/transport_message.c +++ b/src/libopensrf/transport_message.c @@ -495,7 +495,9 @@ void set_msg_error( transport_message* msg, const char* type, int err_code ) { 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; } -- 2.43.2