Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Fix memory leak which occurs after an allocation fai...



details:   https://anonhg.NetBSD.org/src/rev/c8036a724688
branches:  trunk
changeset: 526635:c8036a724688
user:      tron <tron%NetBSD.org@localhost>
date:      Tue May 07 09:14:20 2002 +0000

description:
Fix memory leak which occurs after an allocation failure.

diffstat:

 sys/net/zlib.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (88 lines):

diff -r 8210eea172ff -r c8036a724688 sys/net/zlib.c
--- a/sys/net/zlib.c    Tue May 07 09:14:15 2002 +0000
+++ b/sys/net/zlib.c    Tue May 07 09:14:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $   */
+/*     $NetBSD: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $   */
 /*
  * This file is derived from various .h and .c files from the zlib-1.0.4
  * distribution by Jean-loup Gailly and Mark Adler, with some additions
@@ -11,7 +11,7 @@
  * - added inflateIncomp and deflateOutputPending
  * - allow strm->next_out to be NULL, meaning discard the output
  *
- * $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $
+ * $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $
  */
 
 /* 
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $");
 
 #define NO_DUMMY_DECL
 #define NO_ZCFUNCS
@@ -45,7 +45,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $ */
+/* @(#) $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
@@ -293,7 +293,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $ */
+/* @(#) $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $ */
 
 #ifndef _DEFLATE_H
 #define _DEFLATE_H
@@ -655,7 +655,7 @@
  *
  */
 
-/* @(#) $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $ */
+/* @(#) $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $ */
 
 /* #include "deflate.h" */
 
@@ -886,6 +886,7 @@
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
         s->pending_buf == Z_NULL) {
         strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+       s->status = INIT_STATE;
         deflateEnd (strm);
         return Z_MEM_ERROR;
     }
@@ -1253,6 +1254,7 @@
 
     if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
         ds->pending_buf == Z_NULL) {
+       ds->status = INIT_STATE;
         deflateEnd (dest);
         return Z_MEM_ERROR;
     }
@@ -2017,7 +2019,7 @@
  *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
  */
 
-/* @(#) $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $ */
+/* @(#) $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $ */
 
 /* #define GEN_TREES_H */
 
@@ -5875,7 +5877,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h 
  */
 
-/* @(#) $Id: zlib.c,v 1.17 2002/03/13 03:59:35 fvdl Exp $ */
+/* @(#) $Id: zlib.c,v 1.18 2002/05/07 09:14:20 tron Exp $ */
 
 /* #include "zlib.h" */
 



Home | Main Index | Thread Index | Old Index