summaryrefslogtreecommitdiff
path: root/src/bin/jp2/convertbmp.c
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-09-25 00:08:34 +0200
committermayeut <mayeut@users.noreply.github.com>2015-09-25 00:08:34 +0200
commitb9ca882749597e4943e609daba1d3c27694fe2ff (patch)
tree3b51080def5bc72bd9e5e78cc48591514879cde7 /src/bin/jp2/convertbmp.c
parentf9df8ba19a92d5c97532c8d52c034beabe957cf7 (diff)
Fix resource leaks & unchecked resource allocations
Diffstat (limited to 'src/bin/jp2/convertbmp.c')
-rw-r--r--src/bin/jp2/convertbmp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c
index 78ca4af5..910574b8 100644
--- a/src/bin/jp2/convertbmp.c
+++ b/src/bin/jp2/convertbmp.c
@@ -903,6 +903,10 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
<<-- <<-- <<-- <<-- */
fdest = fopen(outfile, "wb");
+ if (!fdest) {
+ fprintf(stderr, "ERROR -> failed to open %s for writing\n", outfile);
+ return 1;
+ }
w = (int)image->comps[0].w;
h = (int)image->comps[0].h;