Author: cazfi
Date: Wed Jan 14 18:29:33 2015
New Revision: 27679

URL: http://svn.gna.org/viewcvs/freeciv?rev=27679&view=rev
Log:
Fixed minor memory leaks in checking if a file is xz-compressed.

See bug #23171

Modified:
    trunk/utility/ioz.c

Modified: trunk/utility/ioz.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/ioz.c?rev=27679&r1=27678&r2=27679&view=diff
==============================================================================
--- trunk/utility/ioz.c (original)
+++ trunk/utility/ioz.c Wed Jan 14 18:29:33 2015
@@ -283,6 +283,7 @@
                                          XZ_DECODER_MEMLIMIT,
                                          LZMA_CONCATENATED);
     if (fp->u.xz.error != LZMA_OK) {
+      free(fp);
       return NULL;
     }
     fp->u.xz.plain = fc_fopen(filename, test_mode);
@@ -324,6 +325,7 @@
       lzma_end(&fp->u.xz.stream);
       free(fp->u.xz.in_buf);
     } else {
+      free(fp);
       return NULL;
     }
 #endif /* HAVE_LIBLZMA */
@@ -349,6 +351,7 @@
       ret = lzma_easy_encoder(&fp->u.xz.stream, compress_level, 
LZMA_CHECK_CRC32);
       fp->u.xz.error = ret;
       if (ret != LZMA_OK) {
+        free(fp);
         return NULL;
       }
       fp->u.xz.in_buf = fc_malloc(PLAIN_FILE_BUF_SIZE);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to