From: Stefan Weil Date: Fri, 15 Dec 2017 15:49:33 +0000 (+0100) Subject: Fix resource leak (CID 179466) X-Git-Tag: v2.3.1~45^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4841292b5df8f5ed3c92f1760769428ad7500b7a;p=openjpeg Fix resource leak (CID 179466) Coverity report: CID 179466 (#1 of 1): Resource leak (RESOURCE_LEAK) 93. leaked_storage: Variable name going out of scope leaks the storage it points to. Signed-off-by: Stefan Weil --- diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index 7040969d..26af53f2 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -1416,6 +1416,9 @@ int imagetopgx(opj_image_t * image, const char *outfile) unsigned char* line_buffer = malloc((size_t)w); if (line_buffer == NULL) { fprintf(stderr, "Out of memory"); + if (total > 256) { + free(name); + } goto fin; } for (j = 0; j < h; j++) {