g_malloc0 nulls GError*s so a GC-cleanup will not free junk.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 21 Jul 2011 16:59:49 +0000 (09:59 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 21 Jul 2011 16:59:49 +0000 (09:59 -0700)
src/gtk/gio.scm
src/gtk/gtk.cdecl

index 8ae5dd7092040c1915f5cc54b2524f9cbdb6e5f1..5554a9472b0473acfcf4655fa827d0f649ec04c5 100644 (file)
@@ -136,9 +136,8 @@ USA.
         (gerror* (g-input-stream-cancel-info-gerror-pointer info)))
     (add-gc-cleanup object
                    (make-g-input-stream-cleanup info))
-    ((ucode-primitive c-malloc 2) gerror* (C-sizeof "*"))
-    (error-if-null gerror* "Could not create:" gerror*)
-    (C->= gerror* "*" 0)))
+    (C-call "g_malloc0" gerror* (C-sizeof "*"))
+    (error-if-null gerror* "Could not create:" gerror*)))
 
 (define (make-g-input-stream-cleanup info)
   (named-lambda (g-input-stream-cleanup)
index 02c44ebabf2662bae104965cec102eefc3bbcee9..2e207336be35c4d32fb4ae56e898dda3cb93b9e6 100644 (file)
@@ -36,6 +36,10 @@ USA.
 
 ;;; gio.scm
 
+(extern gpointer
+       g_malloc0
+       (n_bytes gsize))
+
 (callback void
          async_ready
          (source (* GObject))