Browse code

libclamav: cleaner textAddMessage(), cid #10532

David Raynor authored on 2013/08/13 07:52:50
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2007-2008 Sourcefire, Inc.
2
+ *  Copyright (C) 2007-2013 Sourcefire, Inc.
3 3
  *
4 4
  *  Authors: Nigel Horne
5 5
  *
... ...
@@ -226,8 +226,11 @@ textAddMessage(text *aText, message *aMessage)
226 226
 	else {
227 227
 		text *anotherText = messageToText(aMessage);
228 228
 
229
-		if(aText)
230
-			return textMove(aText, anotherText);
229
+		if(aText) {
230
+			text *newHead = textMove(aText, anotherText);
231
+			free(anotherText);
232
+			return newHead;
233
+		}
231 234
 		return anotherText;
232 235
 	}
233 236
 }