ffmpeg.c:3307: error: Null Dereference
  pointer `oc` last assigned on line 3296 could be null and is dereferenced at line 3307, column 5.

ffmpeg.c:3286:1: start of procedure opt_output_file()
3284. }
3285. 
3286. static void opt_output_file(const char *filename)
      ^
3287. {
3288.     AVFormatContext *oc;

ffmpeg.c:3291:5: 
3289.     int use_video, use_audio, use_subtitle;
3290.     int input_has_video, input_has_audio, input_has_subtitle;
3291.     AVFormatParameters params, *ap = &params;
          ^
3292. 
3293.     if (!strcmp(filename, "-"))

ffmpeg.c:3293:10: Taking false branch
3291.     AVFormatParameters params, *ap = &params;
3292. 
3293.     if (!strcmp(filename, "-"))
               ^
3294.         filename = "pipe:";
3295. 

ffmpeg.c:3296:5: 
3294.         filename = "pipe:";
3295. 
3296.     oc = av_alloc_format_context();
          ^
3297. 
3298.     if (!file_oformat) {

libavformat/utils.c:426:1: start of procedure av_alloc_format_context()
  424. }
  425. 
  426. AVFormatContext *av_alloc_format_context(void)
       ^
  427. {
  428.     AVFormatContext *ic;

libavformat/utils.c:429:5: 
  427. {
  428.     AVFormatContext *ic;
  429.     ic = av_malloc(sizeof(AVFormatContext));
           ^
  430.     if (!ic) return ic;
  431.     avformat_get_context_defaults(ic);

libavutil/mem.c:42:1: start of procedure av_malloc()
    40.    linker will do it automatically */
    41. 
    42. void *av_malloc(unsigned int size)
        ^
    43. {
    44.     void *ptr;

libavutil/mem.c:50:8: Taking false branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
    59.     ((char*)ptr)[-1]= diff;
    60. #elif defined (HAVE_MEMALIGN)
    61.     ptr = memalign(16,size);
            ^
    62.     /* Why 64?
    63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
    89.     ptr = malloc(size);
    90. #endif
    91.     return ptr;
            ^
    92. }
    93. 

libavutil/mem.c:92:1: return from a call to av_malloc
    90. #endif
    91.     return ptr;
    92. }
        ^
    93. 
    94. void *av_realloc(void *ptr, unsigned int size)

libavformat/utils.c:430:10: Taking true branch
  428.     AVFormatContext *ic;
  429.     ic = av_malloc(sizeof(AVFormatContext));
  430.     if (!ic) return ic;
                ^
  431.     avformat_get_context_defaults(ic);
  432.     ic->av_class = &av_format_context_class;

libavformat/utils.c:430:14: 
  428.     AVFormatContext *ic;
  429.     ic = av_malloc(sizeof(AVFormatContext));
  430.     if (!ic) return ic;
                    ^
  431.     avformat_get_context_defaults(ic);
  432.     ic->av_class = &av_format_context_class;

libavformat/utils.c:434:1: return from a call to av_alloc_format_context
  432.     ic->av_class = &av_format_context_class;
  433.     return ic;
  434. }
       ^
  435. 
  436. int av_open_input_stream(AVFormatContext **ic_ptr,

ffmpeg.c:3298:10: Taking true branch
3296.     oc = av_alloc_format_context();
3297. 
3298.     if (!file_oformat) {
               ^
3299.         file_oformat = guess_format(NULL, filename, NULL);
3300.         if (!file_oformat) {

ffmpeg.c:3299:9: Skipping guess_format(): empty list of specs
3297. 
3298.     if (!file_oformat) {
3299.         file_oformat = guess_format(NULL, filename, NULL);
              ^
3300.         if (!file_oformat) {
3301.             fprintf(stderr, "Unable to find a suitable output format for '%s'\n",

ffmpeg.c:3300:14: Taking true branch
3298.     if (!file_oformat) {
3299.         file_oformat = guess_format(NULL, filename, NULL);
3300.         if (!file_oformat) {
                   ^
3301.             fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3302.                     filename);

ffmpeg.c:3301:13: 
3299.         file_oformat = guess_format(NULL, filename, NULL);
3300.         if (!file_oformat) {
3301.             fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
                  ^
3302.                     filename);
3303.             av_exit(1);

ffmpeg.c:3303:13: Skipping av_exit(): empty list of specs
3301.             fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
3302.                     filename);
3303.             av_exit(1);
                  ^
3304.         }
3305.     }

ffmpeg.c:3307:5: 
3305.     }
3306. 
3307.     oc->oformat = file_oformat;
          ^
3308.     av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3309. 

static void opt_output_file(const char *filename)
{
    AVFormatContext *oc;
    int use_video, use_audio, use_subtitle;
    int input_has_video, input_has_audio, input_has_subtitle;
    AVFormatParameters params, *ap = &params;
    if (!strcmp(filename, "-"))
        filename = "pipe:";
    oc = av_alloc_format_context();
    if (!file_oformat) {
        file_oformat = guess_format(NULL, filename, NULL);
        if (!file_oformat) {
            fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
                    filename);
            av_exit(1);
        }
    }
    oc->oformat = file_oformat;
    av_strlcpy(oc->filename, filename, sizeof(oc->filename));
    if (!strcmp(file_oformat->name, "ffm") &&
        av_strstart(filename, "http:", NULL)) {
        int err = read_ffserver_streams(oc, filename);
        if (err < 0) {
            print_error(filename, err);
            av_exit(1);
        }
    } else {
        use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
        use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
        use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
        if (nb_input_files > 0) {
            check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
                                         &input_has_subtitle);
            if (!input_has_video)
                use_video = 0;
            if (!input_has_audio)
                use_audio = 0;
            if (!input_has_subtitle)
                use_subtitle = 0;
        }
        if (audio_disable) {
            use_audio = 0;
        }
        if (video_disable) {
            use_video = 0;
        }
        if (subtitle_disable) {
            use_subtitle = 0;
        }
        if (use_video) {
            new_video_stream(oc);
        }
        if (use_audio) {
            new_audio_stream(oc);
        }
        if (use_subtitle) {
            new_subtitle_stream(oc);
        }
        oc->timestamp = rec_timestamp;
        if (str_title)
            av_strlcpy(oc->title, str_title, sizeof(oc->title));
        if (str_author)
            av_strlcpy(oc->author, str_author, sizeof(oc->author));
        if (str_copyright)
            av_strlcpy(oc->copyright, str_copyright, sizeof(oc->copyright));
        if (str_comment)
            av_strlcpy(oc->comment, str_comment, sizeof(oc->comment));
        if (str_album)
            av_strlcpy(oc->album, str_album, sizeof(oc->album));
        if (str_genre)
            av_strlcpy(oc->genre, str_genre, sizeof(oc->genre));
    }
    output_files[nb_output_files++] = oc;
    if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
        if (!av_filename_number_test(oc->filename)) {
            print_error(oc->filename, AVERROR_NUMEXPECTED);
            av_exit(1);
        }
    }
    if (!(oc->oformat->flags & AVFMT_NOFILE)) {
        if (!file_overwrite &&
            (strchr(filename, ':') == NULL ||
             filename[1] == ':' ||
             av_strstart(filename, "file:", NULL))) {
            if (url_exist(filename)) {
                int c;
                if (!using_stdin) {
                    fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
                    fflush(stderr);
                    c = getchar();
                    if (toupper(c) != 'Y') {
                        fprintf(stderr, "Not overwriting - exiting\n");
                        av_exit(1);
                    }
                }
                else {
                    fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
                    av_exit(1);
                }
            }
        }
        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
            fprintf(stderr, "Could not open '%s'\n", filename);
            av_exit(1);
        }
    }
    memset(ap, 0, sizeof(*ap));
    if (av_set_parameters(oc, ap) < 0) {
        fprintf(stderr, "%s: Invalid encoding parameters\n",
                oc->filename);
        av_exit(1);
    }
    oc->preload= (int)(mux_preload*AV_TIME_BASE);
    oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
    oc->loop_output = loop_output;
    set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);
    file_oformat = NULL;
    file_iformat = NULL;
}
['static void opt_output_file(const char *filename)\n{\n    AVFormatContext *oc;\n    int use_video, use_audio, use_subtitle;\n    int input_has_video, input_has_audio, input_has_subtitle;\n    AVFormatParameters params, *ap = &params;\n    if (!strcmp(filename, "-"))\n        filename = "pipe:";\n    oc = av_alloc_format_context();\n    if (!file_oformat) {\n        file_oformat = guess_format(NULL, filename, NULL);\n        if (!file_oformat) {\n            fprintf(stderr, "Unable to find a suitable output format for \'%s\'\\n",\n                    filename);\n            av_exit(1);\n        }\n    }\n    oc->oformat = file_oformat;\n    av_strlcpy(oc->filename, filename, sizeof(oc->filename));\n    if (!strcmp(file_oformat->name, "ffm") &&\n        av_strstart(filename, "http:", NULL)) {\n        int err = read_ffserver_streams(oc, filename);\n        if (err < 0) {\n            print_error(filename, err);\n            av_exit(1);\n        }\n    } else {\n        use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;\n        use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;\n        use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;\n        if (nb_input_files > 0) {\n            check_audio_video_sub_inputs(&input_has_video, &input_has_audio,\n                                         &input_has_subtitle);\n            if (!input_has_video)\n                use_video = 0;\n            if (!input_has_audio)\n                use_audio = 0;\n            if (!input_has_subtitle)\n                use_subtitle = 0;\n        }\n        if (audio_disable) {\n            use_audio = 0;\n        }\n        if (video_disable) {\n            use_video = 0;\n        }\n        if (subtitle_disable) {\n            use_subtitle = 0;\n        }\n        if (use_video) {\n            new_video_stream(oc);\n        }\n        if (use_audio) {\n            new_audio_stream(oc);\n        }\n        if (use_subtitle) {\n            new_subtitle_stream(oc);\n        }\n        oc->timestamp = rec_timestamp;\n        if (str_title)\n            av_strlcpy(oc->title, str_title, sizeof(oc->title));\n        if (str_author)\n            av_strlcpy(oc->author, str_author, sizeof(oc->author));\n        if (str_copyright)\n            av_strlcpy(oc->copyright, str_copyright, sizeof(oc->copyright));\n        if (str_comment)\n            av_strlcpy(oc->comment, str_comment, sizeof(oc->comment));\n        if (str_album)\n            av_strlcpy(oc->album, str_album, sizeof(oc->album));\n        if (str_genre)\n            av_strlcpy(oc->genre, str_genre, sizeof(oc->genre));\n    }\n    output_files[nb_output_files++] = oc;\n    if (oc->oformat->flags & AVFMT_NEEDNUMBER) {\n        if (!av_filename_number_test(oc->filename)) {\n            print_error(oc->filename, AVERROR_NUMEXPECTED);\n            av_exit(1);\n        }\n    }\n    if (!(oc->oformat->flags & AVFMT_NOFILE)) {\n        if (!file_overwrite &&\n            (strchr(filename, \':\') == NULL ||\n             filename[1] == \':\' ||\n             av_strstart(filename, "file:", NULL))) {\n            if (url_exist(filename)) {\n                int c;\n                if (!using_stdin) {\n                    fprintf(stderr,"File \'%s\' already exists. Overwrite ? [y/N] ", filename);\n                    fflush(stderr);\n                    c = getchar();\n                    if (toupper(c) != \'Y\') {\n                        fprintf(stderr, "Not overwriting - exiting\\n");\n                        av_exit(1);\n                    }\n                }\n                else {\n                    fprintf(stderr,"File \'%s\' already exists. Exiting.\\n", filename);\n                    av_exit(1);\n                }\n            }\n        }\n        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {\n            fprintf(stderr, "Could not open \'%s\'\\n", filename);\n            av_exit(1);\n        }\n    }\n    memset(ap, 0, sizeof(*ap));\n    if (av_set_parameters(oc, ap) < 0) {\n        fprintf(stderr, "%s: Invalid encoding parameters\\n",\n                oc->filename);\n        av_exit(1);\n    }\n    oc->preload= (int)(mux_preload*AV_TIME_BASE);\n    oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);\n    oc->loop_output = loop_output;\n    set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);\n    file_oformat = NULL;\n    file_iformat = NULL;\n}', 'AVFormatContext *av_alloc_format_context(void)\n{\n    AVFormatContext *ic;\n    ic = av_malloc(sizeof(AVFormatContext));\n    if (!ic) return ic;\n    avformat_get_context_defaults(ic);\n    ic->av_class = &av_format_context_class;\n    return ic;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']