Source-Changes-HG archive

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

[src/trunk]: src/lib/libz Fix memory leak which occurs after an allocation fa...



details:   https://anonhg.NetBSD.org/src/rev/f59d3a13f109
branches:  trunk
changeset: 526633:f59d3a13f109
user:      tron <tron%NetBSD.org@localhost>
date:      Tue May 07 09:06:51 2002 +0000

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

diffstat:

 lib/libz/deflate.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 9d53b687731b -r f59d3a13f109 lib/libz/deflate.c
--- a/lib/libz/deflate.c        Tue May 07 09:03:52 2002 +0000
+++ b/lib/libz/deflate.c        Tue May 07 09:06:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: deflate.c,v 1.8 2002/03/11 23:40:17 fvdl Exp $ */
+/* $NetBSD: deflate.c,v 1.9 2002/05/07 09:06:51 tron Exp $ */
 
 /* deflate.c -- compress data using the deflation algorithm
  * Copyright (C) 1995-2002 Jean-loup Gailly.
@@ -49,7 +49,7 @@
  *
  */
 
-/* @(#) $Id: deflate.c,v 1.8 2002/03/11 23:40:17 fvdl Exp $ */
+/* @(#) $Id: deflate.c,v 1.9 2002/05/07 09:06:51 tron Exp $ */
 
 #include "deflate.h"
 
@@ -276,6 +276,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;
     }
@@ -633,6 +634,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;
     }



Home | Main Index | Thread Index | Old Index