]> granicus.if.org Git - php/commitdiff
-fix possible problem on low memory
authorMarcus Boerger <helly@php.net>
Fri, 29 Mar 2002 01:32:26 +0000 (01:32 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 29 Mar 2002 01:32:26 +0000 (01:32 +0000)
-fix problem on failure

ext/exif/exif.c

index 45c49c99a5396fdf4f084f7fe46e3573f299987d..bb2ed73f49d85cadaf7b01c058816c254bdc186d 100644 (file)
@@ -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;