Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/imbuf/intern/png.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 0ebdeeca343..46c5232a61a 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -189,7 +189,10 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags)
Flush);
} else {
fp = fopen(name, "wb");
- if (!fp) return 0;
+ if (!fp) {
+ MEM_freeN(pixels);
+ return 0;
+ }
png_init_io(png_ptr, fp);
}
@@ -222,8 +225,9 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags)
// allocate memory for an array of row-pointers
row_pointers = (png_bytepp) MEM_mallocN(ibuf->y * sizeof(png_bytep), "row_pointers");
if (row_pointers == NULL) {
- printf("Cannot allocate row-pointers array\n");
- return 0;
+ printf("Cannot allocate row-pointers array\n");
+ MEM_freeN(pixels);
+ return 0;
}
// set the individual row-pointers to point at the correct offsets