libavfilter/audio.c:165: error: Null Dereference
  pointer `outlink->out_buf` last assigned on line 163 could be null and is dereferenced at line 165, column 9.

libavfilter/audio.c:155:1: start of procedure ff_default_filter_samples()
153. 
154. /* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
155. void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
     ^
156. {
157.     AVFilterLink *outlink = NULL;

libavfilter/audio.c:157:5: 
155. void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
156. {
157.     AVFilterLink *outlink = NULL;
         ^
158. 
159.     if (inlink->dst->output_count)

libavfilter/audio.c:159:9: Taking true branch
157.     AVFilterLink *outlink = NULL;
158. 
159.     if (inlink->dst->output_count)
             ^
160.         outlink = inlink->dst->outputs[0];
161. 

libavfilter/audio.c:160:9: 
158. 
159.     if (inlink->dst->output_count)
160.         outlink = inlink->dst->outputs[0];
             ^
161. 
162.     if (outlink) {

libavfilter/audio.c:162:9: Taking true branch
160.         outlink = inlink->dst->outputs[0];
161. 
162.     if (outlink) {
             ^
163.         outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
164.                                                        samplesref->audio->nb_samples);

libavfilter/audio.c:163:9: 
161. 
162.     if (outlink) {
163.         outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
             ^
164.                                                        samplesref->audio->nb_samples);
165.         outlink->out_buf->pts                = samplesref->pts;

libavfilter/audio.c:31:1: start of procedure ff_default_get_audio_buffer()
  29. }
  30. 
  31. AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
      ^
  32.                                                int nb_samples)
  33. {

libavfilter/audio.c:34:5: 
  32.                                                int nb_samples)
  33. {
  34.     AVFilterBufferRef *samplesref = NULL;
          ^
  35.     uint8_t **data;
  36.     int planar      = av_sample_fmt_is_planar(link->format);

libavfilter/audio.c:36:5: 
  34.     AVFilterBufferRef *samplesref = NULL;
  35.     uint8_t **data;
  36.     int planar      = av_sample_fmt_is_planar(link->format);
          ^
  37.     int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
  38.     int planes      = planar ? nb_channels : 1;

libavutil/samplefmt.c:108:1: start of procedure av_sample_fmt_is_planar()
    106. #endif
    107. 
    108. int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
         ^
    109. {
    110.      if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)

libavutil/samplefmt.c:110:10: Taking false branch
    108. int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
    109. {
    110.      if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                  ^
    111.          return 0;
    112.      return sample_fmt_info[sample_fmt].planar;

libavutil/samplefmt.c:110:28: Taking false branch
    108. int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
    109. {
    110.      if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                                    ^
    111.          return 0;
    112.      return sample_fmt_info[sample_fmt].planar;

libavutil/samplefmt.c:112:6: 
    110.      if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
    111.          return 0;
    112.      return sample_fmt_info[sample_fmt].planar;
              ^
    113. }
    114. 

libavutil/samplefmt.c:113:1: return from a call to av_sample_fmt_is_planar
    111.          return 0;
    112.      return sample_fmt_info[sample_fmt].planar;
    113. }
         ^
    114. 
    115. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,

libavfilter/audio.c:37:5: 
  35.     uint8_t **data;
  36.     int planar      = av_sample_fmt_is_planar(link->format);
  37.     int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
          ^
  38.     int planes      = planar ? nb_channels : 1;
  39.     int linesize;

libavutil/audioconvert.c:176:1: start of procedure av_get_channel_layout_nb_channels()
    174. }
    175. 
    176. int av_get_channel_layout_nb_channels(uint64_t channel_layout)
         ^
    177. {
    178.     int count;

libavutil/audioconvert.c:179:5: 
    177. {
    178.     int count;
    179.     uint64_t x = channel_layout;
             ^
    180.     for (count = 0; x; count++)
    181.         x &= x-1; // unset lowest set bit

libavutil/audioconvert.c:180:10: 
    178.     int count;
    179.     uint64_t x = channel_layout;
    180.     for (count = 0; x; count++)
                  ^
    181.         x &= x-1; // unset lowest set bit
    182.     return count;

libavutil/audioconvert.c:180:21: Loop condition is false. Leaving loop
    178.     int count;
    179.     uint64_t x = channel_layout;
    180.     for (count = 0; x; count++)
                             ^
    181.         x &= x-1; // unset lowest set bit
    182.     return count;

libavutil/audioconvert.c:182:5: 
    180.     for (count = 0; x; count++)
    181.         x &= x-1; // unset lowest set bit
    182.     return count;
             ^
    183. }
    184. 

libavutil/audioconvert.c:183:1: return from a call to av_get_channel_layout_nb_channels
    181.         x &= x-1; // unset lowest set bit
    182.     return count;
    183. }
         ^
    184. 
    185. uint64_t av_get_default_channel_layout(int nb_channels)

libavfilter/audio.c:38:23: Condition is true
  36.     int planar      = av_sample_fmt_is_planar(link->format);
  37.     int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
  38.     int planes      = planar ? nb_channels : 1;
                            ^
  39.     int linesize;
  40. 

libavfilter/audio.c:38:5: 
  36.     int planar      = av_sample_fmt_is_planar(link->format);
  37.     int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
  38.     int planes      = planar ? nb_channels : 1;
          ^
  39.     int linesize;
  40. 

libavfilter/audio.c:41:11: 
  39.     int linesize;
  40. 
  41.     if (!(data = av_mallocz(sizeof(*data) * planes)))
                ^
  42.         goto fail;
  43. 

libavutil/mem.c:156:1: start of procedure av_mallocz()
    154. }
    155. 
    156. void *av_mallocz(size_t size)
         ^
    157. {
    158.     void *ptr = av_malloc(size);

libavutil/mem.c:158:5: 
    156. void *av_mallocz(size_t size)
    157. {
    158.     void *ptr = av_malloc(size);
             ^
    159.     if (ptr)
    160.         memset(ptr, 0, size);

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

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

libavutil/mem.c:71:5: 
      69. #endif
      70. 
      71.     assert(size);
              ^
      72. 
      73.     /* let's disallow possible ambiguous cases */

libavutil/mem.c:74:9: Taking false branch
      72. 
      73.     /* let's disallow possible ambiguous cases */
      74.     if (size > (INT_MAX-32) || !size)
                  ^
      75.         return NULL;
      76. 

libavutil/mem.c:74:33: Taking true branch
      72. 
      73.     /* let's disallow possible ambiguous cases */
      74.     if (size > (INT_MAX-32) || !size)
                                          ^
      75.         return NULL;
      76. 

libavutil/mem.c:75:9: 
      73.     /* let's disallow possible ambiguous cases */
      74.     if (size > (INT_MAX-32) || !size)
      75.         return NULL;
                  ^
      76. 
      77. #if CONFIG_MEMALIGN_HACK

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, size_t size)

libavutil/mem.c:159:9: Taking false branch
    157. {
    158.     void *ptr = av_malloc(size);
    159.     if (ptr)
                 ^
    160.         memset(ptr, 0, size);
    161.     return ptr;

libavutil/mem.c:161:5: 
    159.     if (ptr)
    160.         memset(ptr, 0, size);
    161.     return ptr;
             ^
    162. }
    163. 

libavutil/mem.c:162:1: return from a call to av_mallocz
    160.         memset(ptr, 0, size);
    161.     return ptr;
    162. }
         ^
    163. 
    164. char *av_strdup(const char *s)

libavfilter/audio.c:41:11: Taking true branch
  39.     int linesize;
  40. 
  41.     if (!(data = av_mallocz(sizeof(*data) * planes)))
                ^
  42.         goto fail;
  43. 

libavfilter/audio.c:55:1: 
  53.     av_freep(&data);
  54. 
  55. fail:
      ^
  56.     if (data)
  57.         av_freep(&data[0]);

libavfilter/audio.c:56:9: Taking false branch
  54. 
  55. fail:
  56.     if (data)
              ^
  57.         av_freep(&data[0]);
  58.     av_freep(&data);

libavfilter/audio.c:58:5: 
  56.     if (data)
  57.         av_freep(&data[0]);
  58.     av_freep(&data);
          ^
  59.     return samplesref;
  60. }

libavutil/mem.c:149:1: start of procedure av_freep()
    147. }
    148. 
    149. void av_freep(void *arg)
         ^
    150. {
    151.     void **ptr= (void**)arg;

libavutil/mem.c:151:5: 
    149. void av_freep(void *arg)
    150. {
    151.     void **ptr= (void**)arg;
             ^
    152.     av_free(*ptr);
    153.     *ptr = NULL;

libavutil/mem.c:152:5: 
    150. {
    151.     void **ptr= (void**)arg;
    152.     av_free(*ptr);
             ^
    153.     *ptr = NULL;
    154. }

libavutil/mem.c:139:1: start of procedure av_free()
      137. }
      138. 
      139. void av_free(void *ptr)
           ^
      140. {
      141. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:145:5: 
      143.         free((char*)ptr - ((char*)ptr)[-1]);
      144. #else
      145.     free(ptr);
               ^
      146. #endif
      147. }

libavutil/mem.c:147:1: return from a call to av_free
      145.     free(ptr);
      146. #endif
      147. }
           ^
      148. 
      149. void av_freep(void *arg)

libavutil/mem.c:153:5: 
    151.     void **ptr= (void**)arg;
    152.     av_free(*ptr);
    153.     *ptr = NULL;
             ^
    154. }
    155. 

libavutil/mem.c:154:1: return from a call to av_freep
    152.     av_free(*ptr);
    153.     *ptr = NULL;
    154. }
         ^
    155. 
    156. void *av_mallocz(size_t size)

libavfilter/audio.c:59:5: 
  57.         av_freep(&data[0]);
  58.     av_freep(&data);
  59.     return samplesref;
          ^
  60. }
  61. 

libavfilter/audio.c:60:1: return from a call to ff_default_get_audio_buffer
  58.     av_freep(&data);
  59.     return samplesref;
  60. }
      ^
  61. 
  62. AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,

libavfilter/audio.c:165:9: 
163.         outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
164.                                                        samplesref->audio->nb_samples);
165.         outlink->out_buf->pts                = samplesref->pts;
             ^
166.         outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;
167.         ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));

void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
{
    AVFilterLink *outlink = NULL;
    if (inlink->dst->output_count)
        outlink = inlink->dst->outputs[0];
    if (outlink) {
        outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
                                                       samplesref->audio->nb_samples);
        outlink->out_buf->pts                = samplesref->pts;
        outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;
        ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
        avfilter_unref_buffer(outlink->out_buf);
        outlink->out_buf = NULL;
    }
    avfilter_unref_buffer(samplesref);
    inlink->cur_buf = NULL;
}
['void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)\n{\n    AVFilterLink *outlink = NULL;\n    if (inlink->dst->output_count)\n        outlink = inlink->dst->outputs[0];\n    if (outlink) {\n        outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,\n                                                       samplesref->audio->nb_samples);\n        outlink->out_buf->pts                = samplesref->pts;\n        outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;\n        ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));\n        avfilter_unref_buffer(outlink->out_buf);\n        outlink->out_buf = NULL;\n    }\n    avfilter_unref_buffer(samplesref);\n    inlink->cur_buf = NULL;\n}', 'AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,\n                                               int nb_samples)\n{\n    AVFilterBufferRef *samplesref = NULL;\n    uint8_t **data;\n    int planar      = av_sample_fmt_is_planar(link->format);\n    int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);\n    int planes      = planar ? nb_channels : 1;\n    int linesize;\n    if (!(data = av_mallocz(sizeof(*data) * planes)))\n        goto fail;\n    if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0)\n        goto fail;\n    samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, perms,\n                                                           nb_samples, link->format,\n                                                           link->channel_layout);\n    if (!samplesref)\n        goto fail;\n    av_freep(&data);\nfail:\n    if (data)\n        av_freep(&data[0]);\n    av_freep(&data);\n    return samplesref;\n}', 'int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)\n{\n     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)\n         return 0;\n     return sample_fmt_info[sample_fmt].planar;\n}', 'int av_get_channel_layout_nb_channels(uint64_t channel_layout)\n{\n    int count;\n    uint64_t x = channel_layout;\n    for (count = 0; x; count++)\n        x &= x-1;\n    return count;\n}', 'void *av_mallocz(size_t size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    assert(size);\n    if (size > (INT_MAX-32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+32);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&31) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,32,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(32,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'void av_freep(void *arg)\n{\n    void **ptr= (void**)arg;\n    av_free(*ptr);\n    *ptr = NULL;\n}', 'void av_free(void *ptr)\n{\n#if CONFIG_MEMALIGN_HACK\n    if (ptr)\n        free((char*)ptr - ((char*)ptr)[-1]);\n#else\n    free(ptr);\n#endif\n}']