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

ffmpeg.c:3548:1: start of procedure opt_output_file()
3546. }
3547. 
3548. static void opt_output_file(const char *filename)
      ^
3549. {
3550.     AVFormatContext *oc;

ffmpeg.c:3553:5: 
3551.     int err, use_video, use_audio, use_subtitle;
3552.     int input_has_video, input_has_audio, input_has_subtitle;
3553.     AVFormatParameters params, *ap = &params;
          ^
3554.     AVOutputFormat *file_oformat;
3555.     AVMetadataTag *tag = NULL;

ffmpeg.c:3555:5: 
3553.     AVFormatParameters params, *ap = &params;
3554.     AVOutputFormat *file_oformat;
3555.     AVMetadataTag *tag = NULL;
          ^
3556. 
3557.     if (!strcmp(filename, "-"))

ffmpeg.c:3557:10: Taking false branch
3555.     AVMetadataTag *tag = NULL;
3556. 
3557.     if (!strcmp(filename, "-"))
               ^
3558.         filename = "pipe:";
3559. 

ffmpeg.c:3560:5: 
3558.         filename = "pipe:";
3559. 
3560.     oc = avformat_alloc_context();
          ^
3561.     if (!oc) {
3562.         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:3561:10: Taking true branch
3559. 
3560.     oc = avformat_alloc_context();
3561.     if (!oc) {
               ^
3562.         print_error(filename, AVERROR(ENOMEM));
3563.         ffmpeg_exit(1);

ffmpeg.c:3562:9: 
3560.     oc = avformat_alloc_context();
3561.     if (!oc) {
3562.         print_error(filename, AVERROR(ENOMEM));
              ^
3563.         ffmpeg_exit(1);
3564.     }

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:3563:9: Skipping ffmpeg_exit(): empty list of specs
3561.     if (!oc) {
3562.         print_error(filename, AVERROR(ENOMEM));
3563.         ffmpeg_exit(1);
              ^
3564.     }
3565. 

ffmpeg.c:3566:9: Taking true branch
3564.     }
3565. 
3566.     if (last_asked_format) {
              ^
3567.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3568.         if (!file_oformat) {

ffmpeg.c:3567:9: Skipping av_guess_format(): empty list of specs
3565. 
3566.     if (last_asked_format) {
3567.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
              ^
3568.         if (!file_oformat) {
3569.             fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);

ffmpeg.c:3568:14: Taking false branch
3566.     if (last_asked_format) {
3567.         file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3568.         if (!file_oformat) {
                   ^
3569.             fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
3570.             ffmpeg_exit(1);

ffmpeg.c:3572:9: 
3570.             ffmpeg_exit(1);
3571.         }
3572.         last_asked_format = NULL;
              ^
3573.     } else {
3574.         file_oformat = av_guess_format(NULL, filename, NULL);

ffmpeg.c:3582:5: 
3580.     }
3581. 
3582.     oc->oformat = file_oformat;
          ^
3583.     av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3584. 
