Browse code

cid 12123 - fix error state in allocating memory in pdf finalize

Kevin Lin authored on 2015/08/19 03:52:55
Showing 1 changed files
... ...
@@ -260,8 +260,10 @@ char *pdf_finalize_string(struct pdf_struct *pdf, struct pdf_obj *obj, const cha
260 260
     /* TODO: replace the escape sequences directly in the wrkstr   */
261 261
     if (strchr(wrkstr, '\\')) {
262 262
         output = cli_calloc(wrklen+1, sizeof(char));
263
-        if (!output)
263
+        if (!output) {
264
+            free(wrkstr);
264 265
             return NULL;
266
+        }
265 267
 
266 268
         outlen = 0;
267 269
         for (i = 0; i < wrklen; ++i) {