Merge pull request #1047 from stweil/coverity

Fix resource leak (CID 179466)
This commit is contained in:
Even Rouault 2018-01-07 17:49:37 +01:00 committed by GitHub
commit bdcead70d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1416,6 +1416,9 @@ int imagetopgx(opj_image_t * image, const char *outfile)
unsigned char* line_buffer = malloc((size_t)w); unsigned char* line_buffer = malloc((size_t)w);
if (line_buffer == NULL) { if (line_buffer == NULL) {
fprintf(stderr, "Out of memory"); fprintf(stderr, "Out of memory");
if (total > 256) {
free(name);
}
goto fin; goto fin;
} }
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {