LP#1101254: remove memory leak in HTTP translator
authorGalen Charlton <gmc@esilibrary.com>
Fri, 18 Jan 2013 18:12:35 +0000 (13:12 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 15 Mar 2013 12:40:12 +0000 (08:40 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/gateway/osrf_http_translator.c

index 2fed04a..f829fa0 100644 (file)
@@ -331,7 +331,11 @@ static char* osrfHttpTranslatorParseRequest(osrfHttpTranslator* trans) {
         }
     }
 
-    return osrfMessageSerializeBatch(msgList, numMsgs);
+    char* jsonString = osrfMessageSerializeBatch(msgList, numMsgs);
+    for(i = 0; i < numMsgs; i++) {
+        osrfMessageFree(msgList[i]);
+    }
+    return jsonString;
 }
 
 static int osrfHttpTranslatorCheckStatus(osrfHttpTranslator* trans, transport_message* msg) {