libavfilter/af_resample.c:102: error: Null Dereference
  pointer `in_formats` last assigned on line 95 could be null and is dereferenced by call to `ff_formats_ref()` at line 102, column 5.

libavfilter/af_resample.c:90:1: start of procedure query_formats()
88. }
89. 
90. static int query_formats(AVFilterContext *ctx)
    ^
91. {
92.     AVFilterLink *inlink  = ctx->inputs[0];

libavfilter/af_resample.c:92:5: 
90. static int query_formats(AVFilterContext *ctx)
91. {
92.     AVFilterLink *inlink  = ctx->inputs[0];
        ^
93.     AVFilterLink *outlink = ctx->outputs[0];
94. 

libavfilter/af_resample.c:93:5: 
91. {
92.     AVFilterLink *inlink  = ctx->inputs[0];
93.     AVFilterLink *outlink = ctx->outputs[0];
        ^
94. 
95.     AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);

libavfilter/af_resample.c:95:5: 
93.     AVFilterLink *outlink = ctx->outputs[0];
94. 
95.     AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);
        ^
96.     AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);
97.     AVFilterFormats        *in_samplerates  = ff_all_samplerates();

libavfilter/formats.c:218:1: start of procedure ff_all_formats()
  216. }
  217. 
  218. AVFilterFormats *ff_all_formats(enum AVMediaType type)
       ^
  219. {
  220.     AVFilterFormats *ret = NULL;

libavfilter/formats.c:220:5: 
  218. AVFilterFormats *ff_all_formats(enum AVMediaType type)
  219. {
  220.     AVFilterFormats *ret = NULL;
           ^
  221. 
  222.     if (type == AVMEDIA_TYPE_VIDEO) {

libavfilter/formats.c:222:9: Taking false branch
  220.     AVFilterFormats *ret = NULL;
  221. 
  222.     if (type == AVMEDIA_TYPE_VIDEO) {
               ^
  223.         const AVPixFmtDescriptor *desc = NULL;
  224.         while ((desc = av_pix_fmt_desc_next(desc))) {

libavfilter/formats.c:228:16: Taking true branch
  226.                 ff_add_format(&ret, av_pix_fmt_desc_get_id(desc));
  227.         }
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
                      ^
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {

libavfilter/formats.c:229:9: 
  227.         }
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
               ^
  230.         while (av_get_sample_fmt_name(fmt)) {
  231.             ff_add_format(&ret, fmt);

libavfilter/formats.c:230:16: 
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {
                      ^
  231.             ff_add_format(&ret, fmt);
  232.             fmt++;

libavutil/samplefmt.c:47:1: start of procedure av_get_sample_fmt_name()
    45. };
    46. 
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
        ^
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)

libavutil/samplefmt.c:49:9: Taking false branch
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                ^
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;

libavutil/samplefmt.c:49:27: Taking false branch
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                                  ^
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;

libavutil/samplefmt.c:51:5: 
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;
            ^
    52. }
    53. 

libavutil/samplefmt.c:52:1: return from a call to av_get_sample_fmt_name
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;
    52. }
        ^
    53. 
    54. enum AVSampleFormat av_get_sample_fmt(const char *name)

libavfilter/formats.c:230:16: Loop condition is false. Leaving loop
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {
                      ^
  231.             ff_add_format(&ret, fmt);
  232.             fmt++;

libavfilter/formats.c:236:5: 
  234.     }
  235. 
  236.     return ret;
           ^
  237. }
  238. 

libavfilter/formats.c:237:1: return from a call to ff_all_formats
  235. 
  236.     return ret;
  237. }
       ^
  238. 
  239. AVFilterFormats *ff_planar_sample_fmts(void)

libavfilter/af_resample.c:96:5: 
94. 
95.     AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);
96.     AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);
        ^
97.     AVFilterFormats        *in_samplerates  = ff_all_samplerates();
98.     AVFilterFormats        *out_samplerates = ff_all_samplerates();

libavfilter/formats.c:218:1: start of procedure ff_all_formats()
  216. }
  217. 
  218. AVFilterFormats *ff_all_formats(enum AVMediaType type)
       ^
  219. {
  220.     AVFilterFormats *ret = NULL;

libavfilter/formats.c:220:5: 
  218. AVFilterFormats *ff_all_formats(enum AVMediaType type)
  219. {
  220.     AVFilterFormats *ret = NULL;
           ^
  221. 
  222.     if (type == AVMEDIA_TYPE_VIDEO) {

libavfilter/formats.c:222:9: Taking false branch
  220.     AVFilterFormats *ret = NULL;
  221. 
  222.     if (type == AVMEDIA_TYPE_VIDEO) {
               ^
  223.         const AVPixFmtDescriptor *desc = NULL;
  224.         while ((desc = av_pix_fmt_desc_next(desc))) {

libavfilter/formats.c:228:16: Taking true branch
  226.                 ff_add_format(&ret, av_pix_fmt_desc_get_id(desc));
  227.         }
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
                      ^
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {

libavfilter/formats.c:229:9: 
  227.         }
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
               ^
  230.         while (av_get_sample_fmt_name(fmt)) {
  231.             ff_add_format(&ret, fmt);

libavfilter/formats.c:230:16: 
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {
                      ^
  231.             ff_add_format(&ret, fmt);
  232.             fmt++;

libavutil/samplefmt.c:47:1: start of procedure av_get_sample_fmt_name()
    45. };
    46. 
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
        ^
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)

libavutil/samplefmt.c:49:9: Taking false branch
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                ^
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;

libavutil/samplefmt.c:49:27: Taking false branch
    47. const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
    48. {
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
                                  ^
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;

libavutil/samplefmt.c:51:5: 
    49.     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;
            ^
    52. }
    53. 

libavutil/samplefmt.c:52:1: return from a call to av_get_sample_fmt_name
    50.         return NULL;
    51.     return sample_fmt_info[sample_fmt].name;
    52. }
        ^
    53. 
    54. enum AVSampleFormat av_get_sample_fmt(const char *name)

libavfilter/formats.c:230:16: Loop condition is false. Leaving loop
  228.     } else if (type == AVMEDIA_TYPE_AUDIO) {
  229.         enum AVSampleFormat fmt = 0;
  230.         while (av_get_sample_fmt_name(fmt)) {
                      ^
  231.             ff_add_format(&ret, fmt);
  232.             fmt++;

libavfilter/formats.c:236:5: 
  234.     }
  235. 
  236.     return ret;
           ^
  237. }
  238. 

libavfilter/formats.c:237:1: return from a call to ff_all_formats
  235. 
  236.     return ret;
  237. }
       ^
  238. 
  239. AVFilterFormats *ff_planar_sample_fmts(void)

libavfilter/af_resample.c:97:5: Skipping ff_all_samplerates(): empty list of specs
95.     AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);
96.     AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);
97.     AVFilterFormats        *in_samplerates  = ff_all_samplerates();
        ^
98.     AVFilterFormats        *out_samplerates = ff_all_samplerates();
99.     AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();

libavfilter/af_resample.c:98:5: Skipping ff_all_samplerates(): empty list of specs
 96.     AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);
 97.     AVFilterFormats        *in_samplerates  = ff_all_samplerates();
 98.     AVFilterFormats        *out_samplerates = ff_all_samplerates();
         ^
 99.     AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();
100.     AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();

libavfilter/af_resample.c:99:5: Skipping ff_all_channel_layouts(): empty list of specs
 97.     AVFilterFormats        *in_samplerates  = ff_all_samplerates();
 98.     AVFilterFormats        *out_samplerates = ff_all_samplerates();
 99.     AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();
         ^
100.     AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();
101. 

libavfilter/af_resample.c:100:5: Skipping ff_all_channel_layouts(): empty list of specs
 98.     AVFilterFormats        *out_samplerates = ff_all_samplerates();
 99.     AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();
100.     AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();
         ^
101. 
102.     ff_formats_ref(in_formats,  &inlink->out_formats);

libavfilter/af_resample.c:102:5: 
100.     AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();
101. 
102.     ff_formats_ref(in_formats,  &inlink->out_formats);
         ^
103.     ff_formats_ref(out_formats, &outlink->in_formats);
104. 

libavfilter/formats.c:277:1: start of procedure ff_formats_ref()
  275. }
  276. 
  277. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
       ^
  278. {
  279.     FORMATS_REF(f, ref);

libavfilter/formats.c:279:5: 
  277. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
  278. {
  279.     FORMATS_REF(f, ref);
           ^
  280. }
  281. 

static int query_formats(AVFilterContext *ctx)
{
    AVFilterLink *inlink  = ctx->inputs[0];
    AVFilterLink *outlink = ctx->outputs[0];
    AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);
    AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);
    AVFilterFormats        *in_samplerates  = ff_all_samplerates();
    AVFilterFormats        *out_samplerates = ff_all_samplerates();
    AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();
    AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();
    ff_formats_ref(in_formats,  &inlink->out_formats);
    ff_formats_ref(out_formats, &outlink->in_formats);
    ff_formats_ref(in_samplerates,  &inlink->out_samplerates);
    ff_formats_ref(out_samplerates, &outlink->in_samplerates);
    ff_channel_layouts_ref(in_layouts,  &inlink->out_channel_layouts);
    ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
    return 0;
}
['static int query_formats(AVFilterContext *ctx)\n{\n    AVFilterLink *inlink  = ctx->inputs[0];\n    AVFilterLink *outlink = ctx->outputs[0];\n    AVFilterFormats        *in_formats      = ff_all_formats(AVMEDIA_TYPE_AUDIO);\n    AVFilterFormats        *out_formats     = ff_all_formats(AVMEDIA_TYPE_AUDIO);\n    AVFilterFormats        *in_samplerates  = ff_all_samplerates();\n    AVFilterFormats        *out_samplerates = ff_all_samplerates();\n    AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();\n    AVFilterChannelLayouts *out_layouts     = ff_all_channel_layouts();\n    ff_formats_ref(in_formats,  &inlink->out_formats);\n    ff_formats_ref(out_formats, &outlink->in_formats);\n    ff_formats_ref(in_samplerates,  &inlink->out_samplerates);\n    ff_formats_ref(out_samplerates, &outlink->in_samplerates);\n    ff_channel_layouts_ref(in_layouts,  &inlink->out_channel_layouts);\n    ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);\n    return 0;\n}', 'AVFilterFormats *ff_all_formats(enum AVMediaType type)\n{\n    AVFilterFormats *ret = NULL;\n    if (type == AVMEDIA_TYPE_VIDEO) {\n        const AVPixFmtDescriptor *desc = NULL;\n        while ((desc = av_pix_fmt_desc_next(desc))) {\n            if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))\n                ff_add_format(&ret, av_pix_fmt_desc_get_id(desc));\n        }\n    } else if (type == AVMEDIA_TYPE_AUDIO) {\n        enum AVSampleFormat fmt = 0;\n        while (av_get_sample_fmt_name(fmt)) {\n            ff_add_format(&ret, fmt);\n            fmt++;\n        }\n    }\n    return ret;\n}', 'const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)\n{\n    if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)\n        return NULL;\n    return sample_fmt_info[sample_fmt].name;\n}', 'void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)\n{\n    FORMATS_REF(f, ref);\n}']