[PATCH] Fix zlib GC problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix zlib GC problem

Paolo Bonzini
Pointed out by Daniele off list.

Paolo

2007-11-29  Paolo Bonzini  <[hidden email]>

        * zlib.c: Fix potential GC problem.  Reported by Daniele Sciascia.


--- orig/packages/zlib/zlib.c
+++ mod/packages/zlib/zlib.c
@@ -79,10 +79,11 @@ typedef struct zlib_stream {
 void
 gst_deflateInit (OOP oop, int factor, int winSize)
 {
-  zlib_stream zs = (zlib_stream) OOP_TO_OBJ (oop);
   z_stream *zlib_obj = calloc (1, sizeof (z_stream));
 
-  zs->zlibObject = vmProxy->cObjectToOOP (zlib_obj);
+  OOP zlibObjOOP = vmProxy->cObjectToOOP (zlib_obj)
+  zlib_stream zs = (zlib_stream) OOP_TO_OBJ (oop);
+  zs->zlibObject = zlibObjOOP;
   deflateInit2 (zlib_obj, factor, Z_DEFLATED, winSize, 8, Z_DEFAULT_STRATEGY);
 }
 
@@ -90,10 +91,11 @@ gst_deflateInit (OOP oop, int factor, in
 void
 gst_inflateInit (OOP oop, int winSize)
 {
-  zlib_stream zs = (zlib_stream) OOP_TO_OBJ (oop);
   z_stream *zlib_obj = calloc (1, sizeof (z_stream));
 
-  zs->zlibObject = vmProxy->cObjectToOOP (zlib_obj);
+  OOP zlibObjOOP = vmProxy->cObjectToOOP (zlib_obj)
+  zlib_stream zs = (zlib_stream) OOP_TO_OBJ (oop);
+  zs->zlibObject = zlibObjOOP;
   inflateInit2 (zlib_obj, winSize);
 }
 




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk