Memory and fd leak fixes - ID: 3436668
[platform/upstream/flac.git] / src / metaflac / operations_shorthand_picture.c
index 549caca..bc51296 100644 (file)
@@ -163,6 +163,8 @@ FLAC__bool export_pic_to(const char *filename, const FLAC__StreamMetadata *pictu
 
        if(fwrite(picture->data.picture.data, 1, len, f) != len) {
                fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename);
+               if(f != stdout)
+                       fclose(f);
                return false;
        }