Fix misuse of \r (potentially) in flac -d or -t output.
[flac.git] / src / flac / main.c
index 650d1b4..d35c960 100644 (file)
@@ -43,7 +43,7 @@
 #include "utils.h"
 #include "vorbiscomment.h"
 
-#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
+#if defined _MSC_VER || defined __MINGW32__
 #define FLAC__STRCASECMP stricmp
 #else
 #define FLAC__STRCASECMP strcasecmp
@@ -1723,6 +1723,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
                else {
                        if(!memcmp(lookahead, "ID3", 3)) {
                                flac__utils_printf(stderr, 1, "ERROR: input file %s has an ID3v2 tag\n", infilename);
+                               conditional_fclose(encode_infile);
                                return 1;
                        }
                        else if(!memcmp(lookahead, "RIFF", 4) && !memcmp(lookahead+8, "WAVE", 4))
@@ -1932,6 +1933,8 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
                        if(0 == encode_options.format_options.iff.foreign_metadata) {
                                flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n");
                                conditional_fclose(encode_infile);
+                               if(internal_outfilename != 0)
+                                       free(internal_outfilename);
                                return 1;
                        }
                }