[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Fix possible double call to inflateEnd.



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv28048/src/common

Modified Files:
	torgzip.c 
Log Message:
Fix possible double call to inflateEnd.

Index: torgzip.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/torgzip.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- torgzip.c	12 Jul 2005 23:21:15 -0000	1.19
+++ torgzip.c	13 Jul 2005 05:26:43 -0000	1.20
@@ -147,6 +147,7 @@
   struct z_stream_s *stream = NULL;
   size_t out_size;
   off_t offset;
+  int r;
 
   tor_assert(out);
   tor_assert(out_len);
@@ -202,15 +203,15 @@
                stream->msg ? stream->msg : "<no message>");
         goto err;
       }
-
   }
  done:
   *out_len = stream->total_out;
-  if (inflateEnd(stream)!=Z_OK) {
+  r = inflateEnd(stream);
+  tor_free(stream);
+  if (r != Z_OK) {
     log_fn(LOG_WARN, "Error freeing gzip structures");
-    goto err; /* XXX this will try to inflateEnd again, right? is that bad? */
+    goto err;
   }
-  tor_free(stream);
 
   /* NUL-terminate output. */
   if (out_size == *out_len)