jp3d/jpwl/mj2/jpip: Fix resource leaks (#1226)
[openjpeg.git] / src / bin / mj2 / mj2_to_metadata.c
index f7ee63e44f0392cf5a822b5abdeb6a8e5a27e1c8..27f164d7c96de118c1aabac988f10954603467d1 100644 (file)
@@ -304,13 +304,14 @@ int main(int argc, char *argv[])
     xmlout = fopen(outfile, "w"); /* was: argv[2] */
     if (!xmlout) {
         fprintf(stderr, "Failed to open %s for writing.\n", outfile); /* was: argv[2] */
+        fclose(file);
         return 1;
     }
     // Leave it open
 
     /*
     configure the event callbacks (not required)
-    setting of each callback is optionnal
+    setting of each callback is optional
     */
     memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
     event_mgr.error_handler = error_callback;