ffmpeg.c:4193: error: Null Dereference
  pointer `f` last assigned on line 4188 could be null and is dereferenced by call to `feof()` at line 4193, column 12.

ffmpeg.c:4180:1: start of procedure opt_preset()
4178. }
4179. 
4180. static int opt_preset(const char *opt, const char *arg)
      ^
4181. {
4182.     FILE *f=NULL;

ffmpeg.c:4182:5: 
4180. static int opt_preset(const char *opt, const char *arg)
4181. {
4182.     FILE *f=NULL;
          ^
4183.     char filename[1000], tmp[1000], tmp2[1000], line[1000];
4184.     char *codec_name = *opt == 'v' ? video_codec_name :

ffmpeg.c:4184:24: Condition is false
4182.     FILE *f=NULL;
4183.     char filename[1000], tmp[1000], tmp2[1000], line[1000];
4184.     char *codec_name = *opt == 'v' ? video_codec_name :
                             ^
4185.                        *opt == 'a' ? audio_codec_name :
4186.                                      subtitle_codec_name;

ffmpeg.c:4185:24: Condition is false
4183.     char filename[1000], tmp[1000], tmp2[1000], line[1000];
4184.     char *codec_name = *opt == 'v' ? video_codec_name :
4185.                        *opt == 'a' ? audio_codec_name :
                             ^
4186.                                      subtitle_codec_name;
4187. 

ffmpeg.c:4184:24: 
4182.     FILE *f=NULL;
4183.     char filename[1000], tmp[1000], tmp2[1000], line[1000];
4184.     char *codec_name = *opt == 'v' ? video_codec_name :
                             ^
4185.                        *opt == 'a' ? audio_codec_name :
4186.                                      subtitle_codec_name;

ffmpeg.c:4184:5: 
4182.     FILE *f=NULL;
4183.     char filename[1000], tmp[1000], tmp2[1000], line[1000];
4184.     char *codec_name = *opt == 'v' ? video_codec_name :
          ^
4185.                        *opt == 'a' ? audio_codec_name :
4186.                                      subtitle_codec_name;

ffmpeg.c:4188:64: Condition is false
4186.                                      subtitle_codec_name;
4187. 
4188.     if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
                                                                     ^
4189.         fprintf(stderr, "File for preset '%s' not found\n", arg);
4190.         ffmpeg_exit(1);

ffmpeg.c:4188:11: Taking true branch
4186.                                      subtitle_codec_name;
4187. 
4188.     if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
                ^
4189.         fprintf(stderr, "File for preset '%s' not found\n", arg);
4190.         ffmpeg_exit(1);

ffmpeg.c:4189:9: 
4187. 
4188.     if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4189.         fprintf(stderr, "File for preset '%s' not found\n", arg);
              ^
4190.         ffmpeg_exit(1);
4191.     }

ffmpeg.c:4190:9: Skipping ffmpeg_exit(): empty list of specs
4188.     if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4189.         fprintf(stderr, "File for preset '%s' not found\n", arg);
4190.         ffmpeg_exit(1);
              ^
4191.     }
4192. 

ffmpeg.c:4193:12: 
4191.     }
4192. 
4193.     while(!feof(f)){
                 ^
4194.         int e= fscanf(f, "%999[^\n]\n", line) - 1;
4195.         if(line[0] == '#' && !e)

static int opt_preset(const char *opt, const char *arg)
{
    FILE *f=NULL;
    char filename[1000], tmp[1000], tmp2[1000], line[1000];
    char *codec_name = *opt == 'v' ? video_codec_name :
                       *opt == 'a' ? audio_codec_name :
                                     subtitle_codec_name;
    if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
        fprintf(stderr, "File for preset '%s' not found\n", arg);
        ffmpeg_exit(1);
    }
    while(!feof(f)){
        int e= fscanf(f, "%999[^\n]\n", line) - 1;
        if(line[0] == '#' && !e)
            continue;
        e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
        if(e){
            fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
            ffmpeg_exit(1);
        }
        if(!strcmp(tmp, "acodec")){
            opt_audio_codec(tmp2);
        }else if(!strcmp(tmp, "vcodec")){
            opt_video_codec(tmp2);
        }else if(!strcmp(tmp, "scodec")){
            opt_subtitle_codec(tmp2);
        }else if(!strcmp(tmp, "dcodec")){
            opt_data_codec(tmp2);
        }else if(opt_default(tmp, tmp2) < 0){
            fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
            ffmpeg_exit(1);
        }
    }
    fclose(f);
    return 0;
}
['static int opt_preset(const char *opt, const char *arg)\n{\n    FILE *f=NULL;\n    char filename[1000], tmp[1000], tmp2[1000], line[1000];\n    char *codec_name = *opt == \'v\' ? video_codec_name :\n                       *opt == \'a\' ? audio_codec_name :\n                                     subtitle_codec_name;\n    if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == \'f\', codec_name))) {\n        fprintf(stderr, "File for preset \'%s\' not found\\n", arg);\n        ffmpeg_exit(1);\n    }\n    while(!feof(f)){\n        int e= fscanf(f, "%999[^\\n]\\n", line) - 1;\n        if(line[0] == \'#\' && !e)\n            continue;\n        e|= sscanf(line, "%999[^=]=%999[^\\n]\\n", tmp, tmp2) - 2;\n        if(e){\n            fprintf(stderr, "%s: Invalid syntax: \'%s\'\\n", filename, line);\n            ffmpeg_exit(1);\n        }\n        if(!strcmp(tmp, "acodec")){\n            opt_audio_codec(tmp2);\n        }else if(!strcmp(tmp, "vcodec")){\n            opt_video_codec(tmp2);\n        }else if(!strcmp(tmp, "scodec")){\n            opt_subtitle_codec(tmp2);\n        }else if(!strcmp(tmp, "dcodec")){\n            opt_data_codec(tmp2);\n        }else if(opt_default(tmp, tmp2) < 0){\n            fprintf(stderr, "%s: Invalid option or argument: \'%s\', parsed as \'%s\' = \'%s\'\\n", filename, line, tmp, tmp2);\n            ffmpeg_exit(1);\n        }\n    }\n    fclose(f);\n    return 0;\n}']