From 6de7d0c3388f93288449449cc2a711358ffc4529 Mon Sep 17 00:00:00 2001
From: Fred Drake <fdrake@acm.org>
Date: Fri, 18 Dec 1998 19:46:59 +0000
Subject: When _PyString_Resize() reports failure, the variable referring to
 the string we wanted to resize is set to NULL.  Don't Py_DECREF() those
 variables!  (5 places)

---
 Modules/zlibmodule.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 3e4e23d..9cfcbb7 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -224,7 +224,6 @@ PyZlib_decompress(self, args)
               PyErr_SetString(PyExc_MemoryError,
                               "Out of memory while decompressing data");
               inflateEnd(&zst);
-	      Py_DECREF(result_str);
               return NULL;
             }
 	    zst.next_out = (unsigned char *)PyString_AsString(result_str) + r_strlen;
@@ -407,7 +406,6 @@ PyZlib_objcompress(self, args)
 	  if (_PyString_Resize(&RetVal, length << 1) == -1)  {
 	      PyErr_SetString(PyExc_MemoryError,
 			      "Can't allocate memory to compress data");
-	      Py_DECREF(RetVal);
 	      return NULL;
 	  }
 	  self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length;
@@ -466,7 +464,6 @@ PyZlib_objdecompress(self, args)
 	  {
 	      PyErr_SetString(PyExc_MemoryError,
 			      "Can't allocate memory to compress data");
-	      Py_DECREF(RetVal);
 	      return NULL;
 	  }
 	  self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length;
@@ -521,7 +518,6 @@ PyZlib_flush(self, args)
 	  if (_PyString_Resize(&RetVal, length << 1) == -1)  {
 	      PyErr_SetString(PyExc_MemoryError,
 			      "Can't allocate memory to compress data");
-	      Py_DECREF(RetVal);
 	      return NULL;
 	  }
 	  self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length;
@@ -591,7 +587,6 @@ PyZlib_unflush(self, args)
 	  {
 	      PyErr_SetString(PyExc_MemoryError,
 			      "Can't allocate memory to decompress data");
-	      Py_DECREF(RetVal);
 	      return NULL;
 	  }
 	  self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length;
-- 
cgit v0.12

