]> granicus.if.org Git - php/commitdiff
Fixed bug #21518.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jan 2003 18:11:40 +0000 (18:11 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jan 2003 18:11:40 +0000 (18:11 +0000)
Fixed memory in leak ImageCreateFromString().
Fixed a bug that prevented proper identification of WBMP images and thus
prevented ImageCreateFromString() from working on those images.

ext/gd/gd.c
ext/gd/libgd/gd_io_dp.c

index 0a367e5a34c597a34f487c94be3464985d6eeb04..2bced6403d6099f00d6741a5fba37023295b6a41 100644 (file)
@@ -1212,9 +1212,9 @@ static const char php_sig_gd2[3] = {'g', 'd', '2'};
 static int _php_image_type (char data[8])
 {
 #ifdef HAVE_LIBGD15
-       /* Based on ext/standard/images.c */
+       /* Based on ext/standard/image.c */
 
-       if (data == NULL || strlen(data) <= 0)
+       if (data == NULL)
                return -1;
 
        if (!memcmp(data, php_sig_gd2, 3))
@@ -1273,7 +1273,11 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed data is not in '%s' format", tn);
                return NULL;
        }
-
+#if HAVE_LIBGD204
+       io_ctx->gd_free(io_ctx);
+#else
+       io_ctx->free(io_ctx);
+#endif 
        return im;
 }
 /* }}} */
index c41743e78f7617b9c1fc4b866f42d8bb0f46f877..06c3ae80b63212c32b529b4fa20b39112b05cddb 100644 (file)
@@ -145,13 +145,6 @@ gdFreeDynamicCtx (struct gdIOCtx *ctx)
 
   gdFree (ctx);
 
-  /* clean up the data block and return it */
-  if (dp->data != NULL)
-    {
-      gdFree (dp->data);
-      dp->data = NULL;
-    }
-
   dp->realSize = 0;
   dp->logicalSize = 0;