Author: cazfi
Date: Wed Jan 14 18:29:46 2015
New Revision: 27681

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

See bug #23171

Modified:
    branches/S2_5/utility/ioz.c

Modified: branches/S2_5/utility/ioz.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/ioz.c?rev=27681&r1=27680&r2=27681&view=diff
==============================================================================
--- branches/S2_5/utility/ioz.c (original)
+++ branches/S2_5/utility/ioz.c Wed Jan 14 18:29:46 2015
@@ -253,6 +253,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);
@@ -294,6 +295,7 @@
       lzma_end(&fp->u.xz.stream);
       free(fp->u.xz.in_buf);
     } else {
+      free(fp);
       return NULL;
     }
 #endif /* HAVE_LIBLZMA */
@@ -319,6 +321,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