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

ffmpeg.c:3651:1: start of procedure opt_output_file()
3649. }
3650. 
3651. static void opt_output_file(const char *filename)
      ^
3652. {
3653.     AVFormatContext *oc;

ffmpeg.c:3656:5: 
3654.     int err, use_video, use_audio, use_subtitle;
3655.     int input_has_video, input_has_audio, input_has_subtitle;
3656.     AVFormatParameters params, *ap = &params;
          ^
3657.     AVOutputFormat *file_oformat;
3658.     AVMetadataTag *tag = NULL;

ffmpeg.c:3658:5: 
3656.     AVFormatParameters params, *ap = &params;
3657.     AVOutputFormat *file_oformat;
3658.     AVMetadataTag *tag = NULL;
          ^
3659. 
3660.     if (!strcmp(filename, "-"))

ffmpeg.c:3660:10: Taking false branch
3658.     AVMetadataTag *tag = NULL;
3659. 
3660.     if (!strcmp(filename, "-"))
               ^
3661.         filename = "pipe:";
3662. 

ffmpeg.c:3663:5: 
3661.         filename = "pipe:";
3662. 
3663.     oc = avformat_alloc_context();
          ^
3664.     if (!oc) {
3665.         print_error(filename, AVERROR(ENOMEM));

libavformat/options.c:82:1: start of procedure avformat_alloc_context()
  80. }
  81. 
  82. AVFormatContext *avformat_alloc_context(void)
      ^
  83. {
  84.     AVFormatContext *ic;

libavformat/options.c:85:5: 
  83. {
  84.     AVFormatContext *ic;
  85.     ic = av_malloc(sizeof(AVFormatContext));
          ^
  86.     if (!ic) return ic;
  87.     avformat_get_context_defaults(ic);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.    linker will do it automatically. */
    63. 
    64. void *av_malloc(unsigned int size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(unsigned int size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:8: Taking false branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-16) )
               ^
    73.         return NULL;
    74. 

libavutil/mem.c:83:9: Taking false branch
    81.     ((char*)ptr)[-1]= diff;
    82. #elif HAVE_POSIX_MEMALIGN
    83.     if (posix_memalign(&ptr,16,size))
                ^
    84.         ptr = NULL;
    85. #elif HAVE_MEMALIGN

libavutil/mem.c:116:5: 
    114.     ptr = malloc(size);
    115. #endif
    116.     return ptr;
             ^
    117. }
    118. 

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, unsigned int size)

libavformat/options.c:86:10: Taking true branch
  84.     AVFormatContext *ic;
  85.     ic = av_malloc(sizeof(AVFormatContext));
  86.     if (!ic) return ic;
               ^
  87.     avformat_get_context_defaults(ic);
  88.     ic->av_class = &av_format_context_class;

libavformat/options.c:86:14: 
  84.     AVFormatContext *ic;
  85.     ic = av_malloc(sizeof(AVFormatContext));
  86.     if (!ic) return ic;
                   ^
  87.     avformat_get_context_defaults(ic);
  88.     ic->av_class = &av_format_context_class;

libavformat/options.c:90:1: return from a call to avformat_alloc_context
  88.     ic->av_class = &av_format_context_class;
  89.     return ic;
  90. }
      ^
  91. 
  92. #if FF_API_ALLOC_FORMAT_CONTEXT

ffmpeg.c:3664:10: Taking true branch
3662. 
3663.     oc = avformat_alloc_context();
3664.     if (!oc) {
               ^
3665.         print_error(filename, AVERROR(ENOMEM));
3666.         ffmpeg_exit(1);

ffmpeg.c:3665:9: 
3663.     oc = avformat_alloc_context();
3664.     if (!oc) {
3665.         print_error(filename, AVERROR(ENOMEM));
              ^
3666.         ffmpeg_exit(1);
3667.     }

cmdutils.c:342:1: start of procedure print_error()
  340. }
  341. 
  342. void print_error(const char *filename, int err)
       ^
  343. {
  344.     char errbuf[128];

cmdutils.c:345:5: 
  343. {
  344.     char errbuf[128];
  345.     const char *errbuf_ptr = errbuf;
           ^
  346. 
  347.     if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)

cmdutils.c:347:9: 
  345.     const char *errbuf_ptr = errbuf;
  346. 
  347.     if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
               ^
  348.         errbuf_ptr = strerror(AVUNERROR(err));
  349.     fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);

libavutil/error.c:22:1: start of procedure av_strerror()
    20. #include "avstring.h"
    21. 
    22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
        ^
    23. {
    24.     int ret = 0;

libavutil/error.c:24:5: 
    22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
    23. {
    24.     int ret = 0;
            ^
    25.     const char *errstr = NULL;
    26. 

libavutil/error.c:25:5: 
    23. {
    24.     int ret = 0;
    25.     const char *errstr = NULL;
            ^
    26. 
    27.     switch (errnum) {

libavutil/error.c:27:5: 
    25.     const char *errstr = NULL;
    26. 
    27.     switch (errnum) {
            ^
    28.     case AVERROR_EOF:               errstr = "End of file"; break;
    29.     case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;

libavutil/error.c:28:5: Switch condition is false. Skipping switch case
    26. 
    27.     switch (errnum) {
    28.     case AVERROR_EOF:               errstr = "End of file"; break;
            ^
    29.     case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;
    30.     case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;

libavutil/error.c:29:5: Switch condition is false. Skipping switch case
    27.     switch (errnum) {
    28.     case AVERROR_EOF:               errstr = "End of file"; break;
    29.     case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;
            ^
    30.     case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;
    31.     case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;

libavutil/error.c:30:5: Switch condition is false. Skipping switch case
    28.     case AVERROR_EOF:               errstr = "End of file"; break;
    29.     case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;
    30.     case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;
            ^
    31.     case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
    32.     }

libavutil/error.c:31:5: Switch condition is false. Skipping switch case
    29.     case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;
    30.     case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;
    31.     case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
            ^
    32.     }
    33. 

libavutil/error.c:34:9: Taking false branch
    32.     }
    33. 
    34.     if (errstr) {
                ^
    35.         av_strlcpy(errbuf, errstr, errbuf_size);
    36.     } else {

libavutil/error.c:38:9: 
    36.     } else {
    37. #if HAVE_STRERROR_R
    38.         ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
                ^
    39. #else
    40.         ret = -1;

libavutil/error.c:42:13: Taking false branch
    40.         ret = -1;
    41. #endif
    42.         if (ret < 0)
                    ^
    43.             snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
    44.     }

libavutil/error.c:46:5: 
    44.     }
    45. 
    46.     return ret;
            ^
    47. }

libavutil/error.c:47:1: return from a call to av_strerror
    45. 
    46.     return ret;
    47. }
        ^

cmdutils.c:347:9: Taking false branch
  345.     const char *errbuf_ptr = errbuf;
  346. 
  347.     if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
               ^
  348.         errbuf_ptr = strerror(AVUNERROR(err));
  349.     fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);

cmdutils.c:349:5: 
  347.     if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
  348.         errbuf_ptr = strerror(AVUNERROR(err));
  349.     fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
           ^
  350. }
  351. 

cmdutils.c:350:1: return from a call to print_error
  348.         errbuf_ptr = strerror(AVUNERROR(err));
  349.     fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
  350. }
       ^
  351. 
  352. static int warned_cfg = 0;

ffmpeg.c:3666:9: Skipping ffmpeg_exit(): empty list of specs
3664.     if (!oc) {
3665.         print_error(filename, AVERROR(ENOMEM));
3666.         ffmpeg_exit(1);
              ^
3667.     }
3668. 

ffmpeg.c:3669:9: Taking true branch
3667.     }
3668. 
3669.     if (last_asked_format) {
              ^
3670.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3671.         if (!file_oformat) {

ffmpeg.c:3670:9: Skipping av_guess_format(): empty list of specs
3668. 
3669.     if (last_asked_format) {
3670.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
              ^
3671.         if (!file_oformat) {
3672.             fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);

ffmpeg.c:3671:14: Taking false branch
3669.     if (last_asked_format) {
3670.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3671.         if (!file_oformat) {
                   ^
3672.             fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
3673.             ffmpeg_exit(1);

ffmpeg.c:3675:9: 
3673.             ffmpeg_exit(1);
3674.         }
3675.         last_asked_format = NULL;
              ^
3676.     } else {
3677.         file_oformat = av_guess_format(NULL, filename, NULL);

ffmpeg.c:3685:5: 
3683.     }
3684. 
3685.     oc->oformat = file_oformat;
          ^
3686.     av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3687. 
