diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-08 18:11:40 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-08 18:11:40 +0000 |
commit | 17e51c5946905056de10e10693c2923731a9f3e4 (patch) | |
tree | f05109b3d64708b3daa62c50034cb20a1b80c23b | |
parent | 24d034251d5b8d3f533c7ec91e42a7a176b26741 (diff) | |
download | php-git-17e51c5946905056de10e10693c2923731a9f3e4.tar.gz |
Fixed bug #21518.
Fixed memory in leak ImageCreateFromString().
Fixed a bug that prevented proper identification of WBMP images and thus
prevented ImageCreateFromString() from working on those images.
-rw-r--r-- | ext/gd/gd.c | 10 | ||||
-rw-r--r-- | ext/gd/libgd/gd_io_dp.c | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 0a367e5a34..2bced6403d 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -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; } /* }}} */ diff --git a/ext/gd/libgd/gd_io_dp.c b/ext/gd/libgd/gd_io_dp.c index c41743e78f..06c3ae80b6 100644 --- a/ext/gd/libgd/gd_io_dp.c +++ b/ext/gd/libgd/gd_io_dp.c @@ -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; |