Avoid invalid delete call when loading multilayer EXR files with that don't fit the...
authorLukas Toenne <lukas.toenne@googlemail.com>
Mon, 16 Apr 2012 11:57:22 +0000 (11:57 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Mon, 16 Apr 2012 11:57:22 +0000 (11:57 +0000)
source/blender/imbuf/intern/openexr/openexr_api.cpp

index caca00cbe200da1e9c381821777f769260ed8ba3..ff3a816f4784546156bc0767f1c9f18605c596ea 100644 (file)
@@ -1007,7 +1007,6 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
                                        if (handle) {
                                                IMB_exr_read_channels(handle);
                                                ibuf->userdata= handle;                 /* potential danger, the caller has to check for this! */
-                                               return ibuf;
                                        }
                                }
                                else {
@@ -1055,11 +1054,12 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
                                        //
                                        // if (flag & IM_rect)
                                        //     IMB_rect_from_float(ibuf);
+                                       
+                                       /* file is no longer needed */
+                                       delete file;
                                }
                        }
-                       
                }
-               delete file;
                return(ibuf);
        }
        catch (const std::exception &exc)