ffserver.c:3314: error: Null Dereference
  pointer `stream->ap_in` last assigned on line 3310 could be null and is dereferenced at line 3314, column 17.

ffserver.c:3296:1: start of procedure build_file_streams()
3294. 
3295. /* compute the needed AVStream for each file */
3296. static void build_file_streams(void)
      ^
3297. {
3298.     FFStream *stream, *stream_next;

ffserver.c:3303:9: 
3301. 
3302.     /* gather all streams */
3303.     for(stream = first_stream; stream != NULL; stream = stream_next) {
              ^
3304.         stream_next = stream->next;
3305.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3303:32: Loop condition is true. Entering loop body
3301. 
3302.     /* gather all streams */
3303.     for(stream = first_stream; stream != NULL; stream = stream_next) {
                                     ^
3304.         stream_next = stream->next;
3305.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3304:9: 
3302.     /* gather all streams */
3303.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3304.         stream_next = stream->next;
              ^
3305.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3306.             !stream->feed) {

ffserver.c:3305:13: Taking true branch
3303.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3304.         stream_next = stream->next;
3305.         if (stream->stream_type == STREAM_TYPE_LIVE &&
                  ^
3306.             !stream->feed) {
3307.             /* the stream comes from a file */

ffserver.c:3306:14: Taking true branch
3304.         stream_next = stream->next;
3305.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3306.             !stream->feed) {
                   ^
3307.             /* the stream comes from a file */
3308.             /* try to open the file */

ffserver.c:3310:13: 
3308.             /* try to open the file */
3309.             /* open stream */
3310.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
                  ^
3311.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
3312.                 /* specific case : if transport stream output to RTP,

libavutil/mem.c:132:1: start of procedure av_mallocz()
  130. }
  131. 
  132. void *av_mallocz(unsigned int size)
       ^
  133. {
  134.     void *ptr = av_malloc(size);

libavutil/mem.c:134:5: 
  132. void *av_mallocz(unsigned int size)
  133. {
  134.     void *ptr = av_malloc(size);
           ^
  135.     if (ptr)
  136.         memset(ptr, 0, size);

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)

libavutil/mem.c:135:9: Taking false branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:137:5: 
  135.     if (ptr)
  136.         memset(ptr, 0, size);
  137.     return ptr;
           ^
  138. }
  139. 

libavutil/mem.c:138:1: return from a call to av_mallocz
  136.         memset(ptr, 0, size);
  137.     return ptr;
  138. }
       ^
  139. 
  140. char *av_strdup(const char *s)

ffserver.c:3311:17: Taking true branch
3309.             /* open stream */
3310.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3311.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                      ^
3312.                 /* specific case : if transport stream output to RTP,
3313.                    we use a raw transport stream reader */

ffserver.c:3311:33: Taking true branch
3309.             /* open stream */
3310.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3311.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                                      ^
3312.                 /* specific case : if transport stream output to RTP,
3313.                    we use a raw transport stream reader */

ffserver.c:3314:17: 
3312.                 /* specific case : if transport stream output to RTP,
3313.                    we use a raw transport stream reader */
3314.                 stream->ap_in->mpeg2ts_raw = 1;
                      ^
3315.                 stream->ap_in->mpeg2ts_compute_pcr = 1;
3316.             }

static void build_file_streams(void)
{
    FFStream *stream, *stream_next;
    AVFormatContext *infile;
    int i;
    for(stream = first_stream; stream != NULL; stream = stream_next) {
        stream_next = stream->next;
        if (stream->stream_type == STREAM_TYPE_LIVE &&
            !stream->feed) {
            stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
            if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                stream->ap_in->mpeg2ts_raw = 1;
                stream->ap_in->mpeg2ts_compute_pcr = 1;
            }
            if (av_open_input_file(&infile, stream->feed_filename,
                                   stream->ifmt, 0, stream->ap_in) < 0) {
                http_log("%s not found", stream->feed_filename);
            fail:
                remove_stream(stream);
            } else {
                if (av_find_stream_info(infile) < 0) {
                    http_log("Could not find codec parameters from '%s'",
                             stream->feed_filename);
                    av_close_input_file(infile);
                    goto fail;
                }
                extract_mpeg4_header(infile);
                for(i=0;i<infile->nb_streams;i++)
                    add_av_stream1(stream, infile->streams[i]->codec);
                av_close_input_file(infile);
            }
        }
    }
}
['static void build_file_streams(void)\n{\n    FFStream *stream, *stream_next;\n    AVFormatContext *infile;\n    int i;\n    for(stream = first_stream; stream != NULL; stream = stream_next) {\n        stream_next = stream->next;\n        if (stream->stream_type == STREAM_TYPE_LIVE &&\n            !stream->feed) {\n            stream->ap_in = av_mallocz(sizeof(AVFormatParameters));\n            if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {\n                stream->ap_in->mpeg2ts_raw = 1;\n                stream->ap_in->mpeg2ts_compute_pcr = 1;\n            }\n            if (av_open_input_file(&infile, stream->feed_filename,\n                                   stream->ifmt, 0, stream->ap_in) < 0) {\n                http_log("%s not found", stream->feed_filename);\n            fail:\n                remove_stream(stream);\n            } else {\n                if (av_find_stream_info(infile) < 0) {\n                    http_log("Could not find codec parameters from \'%s\'",\n                             stream->feed_filename);\n                    av_close_input_file(infile);\n                    goto fail;\n                }\n                extract_mpeg4_header(infile);\n                for(i=0;i<infile->nb_streams;i++)\n                    add_av_stream1(stream, infile->streams[i]->codec);\n                av_close_input_file(infile);\n            }\n        }\n    }\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\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}']