From: Marcus Boerger Date: Fri, 29 Mar 2002 01:32:26 +0000 (+0000) Subject: -fix possible problem on low memory X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~983 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0be2aabe4f3e342f8579418401f3d9b1714f655;p=php -fix possible problem on low memory -fix problem on failure --- diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 45c49c99a5..bb2ed73f49 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -1052,7 +1052,7 @@ void exif_iif_add_value( image_info_type *image_info, int section_index, char *n if ( !info_value->s) { EXIF_ERRLOG_EALLOC info_data->length = 0; - return; + break; /* better return with "" instead of possible casing problems */ } break; @@ -3060,7 +3060,8 @@ PHP_FUNCTION(exif_read_data) ImageInfo.sections_found |= FOUND_COMPUTED;/* do not inform about in debug*/ - if (ret==FALSE || array_init(return_value) == FAILURE || (sections_needed && !(sections_needed&ImageInfo.sections_found))) { + if (ret==FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found) || array_init(return_value) == FAILURE)) { + /* array_init must be checked at last! otherwise the array must be freed if a later test fails. */ exif_discard_imageinfo(&ImageInfo); if ( sections_str) efree(sections_str); RETURN_FALSE;