Author: cazfi
Date: Wed Mar  2 12:38:26 2016
New Revision: 32153

URL: http://svn.gna.org/viewcvs/freeciv?rev=32153&view=rev
Log:
Make sure bz2-decompressor stream is NULL when the underlying filestream is 
NULL.

See patch #7024

Modified:
    trunk/utility/ioz.c

Modified: trunk/utility/ioz.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/ioz.c?rev=32153&r1=32152&r2=32153&view=diff
==============================================================================
--- trunk/utility/ioz.c (original)
+++ trunk/utility/ioz.c Wed Mar  2 12:38:26 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,17 +11,17 @@
    GNU General Public License for more details.
 ***********************************************************************/
 
-/********************************************************************** 
+/**********************************************************************
   An IO layer to support transparent compression/uncompression.
   (Currently only "required" functionality is supported.)
 
   There are various reasons for making this a full-blown module
   instead of just defining a few macros:
-  
+
   - Ability to switch between compressed and uncompressed at run-time
     (zlib with compression level 0 saves uncompressed, but still with
     gzip header, so non-zlib server cannot read the savefile).
-    
+
   - Flexibility to add other methods if desired (eg, bzip2, arbitrary
     external filter program, etc).
 
@@ -236,6 +236,9 @@
     if (fp->u.bz2.plain) {
       fp->u.bz2.file = BZ2_bzReadOpen(&fp->u.bz2.error, fp->u.bz2.plain, 1, 0,
                                       NULL, 0);
+    } else {
+      /* This may currently have garbage value assigned via other union 
member. */
+      fp->u.bz2.file = NULL;
     }
     if (!fp->u.bz2.file) {
       if (fp->u.bz2.plain) {


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

Reply via email to