metaflac: Fix a memory leak
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 9 Apr 2017 05:17:06 +0000 (15:17 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 9 Apr 2017 05:17:06 +0000 (15:17 +1000)
src/metaflac/operations.c

index 119d497..952f1d6 100644 (file)
@@ -286,7 +286,8 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi
 
        if(!FLAC__metadata_chain_read(chain, filename)) {
                print_error_with_chain_status(chain, "%s: ERROR: reading metadata", filename);
-               return false;
+               ok = false;
+               goto cleanup;
        }
 
        for(i = 0; i < options->ops.num_operations && ok; i++) {
@@ -325,6 +326,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi
                        print_error_with_chain_status(chain, "%s: ERROR: writing FLAC file", filename);
        }
 
+  cleanup :
        FLAC__metadata_chain_delete(chain);
 
        return ok;