ffserver.c:3361: error: Memory Leak
  `stream` is not reachable after line 3361, column 14.

ffserver.c:3351:1: start of procedure build_file_streams()
3349. 
3350. /* compute the needed AVStream for each file */
3351. static void build_file_streams(void)
      ^
3352. {
3353.     FFStream *stream, *stream_next;

ffserver.c:3358:9: 
3356. 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
              ^
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3358:32: Loop condition is true. Entering loop body
3356. 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
                                     ^
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3359:9: 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3359.         stream_next = stream->next;
              ^
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3361.             !stream->feed) {

ffserver.c:3360:13: Taking true branch
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
                  ^
3361.             !stream->feed) {
3362.             /* the stream comes from a file */

ffserver.c:3361:14: Taking true branch
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3361.             !stream->feed) {
                   ^
3362.             /* the stream comes from a file */
3363.             /* try to open the file */

ffserver.c:3365:13: 
3363.             /* try to open the file */
3364.             /* open stream */
3365.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
                  ^
3366.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
3367.                 /* 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:3366:17: Taking true branch
3364.             /* open stream */
3365.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3366.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                      ^
3367.                 /* specific case : if transport stream output to RTP,
3368.                    we use a raw transport stream reader */

ffserver.c:3366:33: Taking false branch
3364.             /* open stream */
3365.             stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3366.             if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                                      ^
3367.                 /* specific case : if transport stream output to RTP,
3368.                    we use a raw transport stream reader */

ffserver.c:3373:17: 
3371.             }
3372. 
3373.             if ((ret = av_open_input_file(&infile, stream->feed_filename,
                      ^
3374.                                           stream->ifmt, 0, stream->ap_in)) < 0) {
3375.                 http_log("could not open %s: %d\n", stream->feed_filename, ret);

libavformat/utils.c:507:1: start of procedure av_open_input_file()
  505. #define PROBE_BUF_MAX (1<<20)
  506. 
  507. int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
       ^
  508.                        AVInputFormat *fmt,
  509.                        int buf_size,

libavformat/utils.c:513:5: 
  511. {
  512.     int err, probe_size;
  513.     AVProbeData probe_data, *pd = &probe_data;
           ^
  514.     ByteIOContext *pb = NULL;
  515. 

libavformat/utils.c:514:5: 
  512.     int err, probe_size;
  513.     AVProbeData probe_data, *pd = &probe_data;
  514.     ByteIOContext *pb = NULL;
           ^
  515. 
  516.     pd->filename = "";

libavformat/utils.c:516:5: 
  514.     ByteIOContext *pb = NULL;
  515. 
  516.     pd->filename = "";
           ^
  517.     if (filename)
  518.         pd->filename = filename;

libavformat/utils.c:517:9: Taking true branch
  515. 
  516.     pd->filename = "";
  517.     if (filename)
               ^
  518.         pd->filename = filename;
  519.     pd->buf = NULL;

libavformat/utils.c:518:9: 
  516.     pd->filename = "";
  517.     if (filename)
  518.         pd->filename = filename;
               ^
  519.     pd->buf = NULL;
  520.     pd->buf_size = 0;

libavformat/utils.c:519:5: 
  517.     if (filename)
  518.         pd->filename = filename;
  519.     pd->buf = NULL;
           ^
  520.     pd->buf_size = 0;
  521. 

libavformat/utils.c:520:5: 
  518.         pd->filename = filename;
  519.     pd->buf = NULL;
  520.     pd->buf_size = 0;
           ^
  521. 
  522.     if (!fmt) {

libavformat/utils.c:522:10: Taking false branch
  520.     pd->buf_size = 0;
  521. 
  522.     if (!fmt) {
                ^
  523.         /* guess format if no file can be opened */
  524.         fmt = av_probe_input_format(pd, 0);

libavformat/utils.c:529:10: Taking false branch
  527.     /* Do not open file if the format does not need it. XXX: specific
  528.        hack needed to handle RTSP/TCP */
  529.     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
                ^
  530.         /* if no file needed do not try to open one */
  531.         if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {

libavformat/utils.c:529:19: Taking true branch
  527.     /* Do not open file if the format does not need it. XXX: specific
  528.        hack needed to handle RTSP/TCP */
  529.     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
                         ^
  530.         /* if no file needed do not try to open one */
  531.         if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {

libavformat/utils.c:531:13: 
  529.     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
  530.         /* if no file needed do not try to open one */
  531.         if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
                   ^
  532.             goto fail;
  533.         }

libavformat/aviobuf.c:585:1: start of procedure url_fopen()
    583. }
    584. 
    585. int url_fopen(ByteIOContext **s, const char *filename, int flags)
         ^
    586. {
    587.     URLContext *h;

libavformat/aviobuf.c:590:5: Skipping url_open(): empty list of specs
    588.     int err;
    589. 
    590.     err = url_open(&h, filename, flags);
             ^
    591.     if (err < 0)
    592.         return err;

libavformat/aviobuf.c:591:9: Taking true branch
    589. 
    590.     err = url_open(&h, filename, flags);
    591.     if (err < 0)
                 ^
    592.         return err;
    593.     err = url_fdopen(s, h);

libavformat/aviobuf.c:592:9: 
    590.     err = url_open(&h, filename, flags);
    591.     if (err < 0)
    592.         return err;
                 ^
    593.     err = url_fdopen(s, h);
    594.     if (err < 0) {

libavformat/aviobuf.c:599:1: return from a call to url_fopen
    597.     }
    598.     return 0;
    599. }
         ^
    600. 
    601. int url_fclose(ByteIOContext *s)

libavformat/utils.c:531:13: Taking true branch
  529.     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
  530.         /* if no file needed do not try to open one */
  531.         if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
                   ^
  532.             goto fail;
  533.         }

libavformat/utils.c:575:2: 
  573.         goto fail;
  574.     return 0;
  575.  fail:
        ^
  576.     av_freep(&pd->buf);
  577.     if (pb)

libavformat/utils.c:576:5: 
  574.     return 0;
  575.  fail:
  576.     av_freep(&pd->buf);
           ^
  577.     if (pb)
  578.         url_fclose(pb);

libavutil/mem.c:125:1: start of procedure av_freep()
    123. }
    124. 
    125. void av_freep(void *arg)
         ^
    126. {
    127.     void **ptr= (void**)arg;

libavutil/mem.c:127:5: 
    125. void av_freep(void *arg)
    126. {
    127.     void **ptr= (void**)arg;
             ^
    128.     av_free(*ptr);
    129.     *ptr = NULL;

libavutil/mem.c:128:5: 
    126. {
    127.     void **ptr= (void**)arg;
    128.     av_free(*ptr);
             ^
    129.     *ptr = NULL;
    130. }

libavutil/mem.c:114:1: start of procedure av_free()
      112. }
      113. 
      114. void av_free(void *ptr)
           ^
      115. {
      116.     /* XXX: this test should not be needed on most libcs */

libavutil/mem.c:117:9: Taking false branch
      115. {
      116.     /* XXX: this test should not be needed on most libcs */
      117.     if (ptr)
                   ^
      118. #ifdef CONFIG_MEMALIGN_HACK
      119.         free((char*)ptr - ((char*)ptr)[-1]);

libavutil/mem.c:117:5: 
      115. {
      116.     /* XXX: this test should not be needed on most libcs */
      117.     if (ptr)
               ^
      118. #ifdef CONFIG_MEMALIGN_HACK
      119.         free((char*)ptr - ((char*)ptr)[-1]);

libavutil/mem.c:123:1: return from a call to av_free
      121.         free(ptr);
      122. #endif
      123. }
           ^
      124. 
      125. void av_freep(void *arg)

libavutil/mem.c:129:5: 
    127.     void **ptr= (void**)arg;
    128.     av_free(*ptr);
    129.     *ptr = NULL;
             ^
    130. }
    131. 

libavutil/mem.c:130:1: return from a call to av_freep
    128.     av_free(*ptr);
    129.     *ptr = NULL;
    130. }
         ^
    131. 
    132. void *av_mallocz(unsigned int size)

libavformat/utils.c:577:9: Taking false branch
  575.  fail:
  576.     av_freep(&pd->buf);
  577.     if (pb)
               ^
  578.         url_fclose(pb);
  579.     *ic_ptr = NULL;

libavformat/utils.c:579:5: 
  577.     if (pb)
  578.         url_fclose(pb);
  579.     *ic_ptr = NULL;
           ^
  580.     return err;
  581. 

libavformat/utils.c:580:5: 
  578.         url_fclose(pb);
  579.     *ic_ptr = NULL;
  580.     return err;
           ^
  581. 
  582. }

libavformat/utils.c:582:1: return from a call to av_open_input_file
  580.     return err;
  581. 
  582. }
       ^
  583. 
  584. /*******************************************************/

ffserver.c:3373:17: Taking true branch
3371.             }
3372. 
3373.             if ((ret = av_open_input_file(&infile, stream->feed_filename,
                      ^
3374.                                           stream->ifmt, 0, stream->ap_in)) < 0) {
3375.                 http_log("could not open %s: %d\n", stream->feed_filename, ret);

ffserver.c:3375:17: 
3373.             if ((ret = av_open_input_file(&infile, stream->feed_filename,
3374.                                           stream->ifmt, 0, stream->ap_in)) < 0) {
3375.                 http_log("could not open %s: %d\n", stream->feed_filename, ret);
                      ^
3376.                 /* remove stream (no need to spend more time on it) */
3377.             fail:

ffserver.c:339:1: start of procedure http_log()
  337. }
  338. 
  339. void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
       ^
  340. {
  341.     va_list vargs;

ffserver.c:342:5: 
  340. {
  341.     va_list vargs;
  342.     va_start(vargs, fmt);
           ^
  343.     http_vlog(fmt, vargs);
  344.     va_end(vargs);

ffserver.c:343:5: 
  341.     va_list vargs;
  342.     va_start(vargs, fmt);
  343.     http_vlog(fmt, vargs);
           ^
  344.     va_end(vargs);
  345. }

ffserver.c:324:1: start of procedure http_vlog()
    322. }
    323. 
    324. static void http_vlog(const char *fmt, va_list vargs)
         ^
    325. {
    326.     static int print_prefix = 1;

ffserver.c:326:5: 
    324. static void http_vlog(const char *fmt, va_list vargs)
    325. {
    326.     static int print_prefix = 1;
             ^
    327.     if (logfile) {
    328.         if (print_prefix) {

ffserver.c:327:9: Taking true branch
    325. {
    326.     static int print_prefix = 1;
    327.     if (logfile) {
                 ^
    328.         if (print_prefix) {
    329.             char buf[32];

ffserver.c:328:13: Taking true branch
    326.     static int print_prefix = 1;
    327.     if (logfile) {
    328.         if (print_prefix) {
                     ^
    329.             char buf[32];
    330.             ctime1(buf);

ffserver.c:330:13: Skipping ctime1(): empty list of specs
    328.         if (print_prefix) {
    329.             char buf[32];
    330.             ctime1(buf);
                     ^
    331.             fprintf(logfile, "%s ", buf);
    332.         }

ffserver.c:331:13: 
    329.             char buf[32];
    330.             ctime1(buf);
    331.             fprintf(logfile, "%s ", buf);
                     ^
    332.         }
    333.         print_prefix = strstr(fmt, "\n") != NULL;

ffserver.c:333:24: Condition is true
    331.             fprintf(logfile, "%s ", buf);
    332.         }
    333.         print_prefix = strstr(fmt, "\n") != NULL;
                                ^
    334.         vfprintf(logfile, fmt, vargs);
    335.         fflush(logfile);

ffserver.c:333:9: 
    331.             fprintf(logfile, "%s ", buf);
    332.         }
    333.         print_prefix = strstr(fmt, "\n") != NULL;
                 ^
    334.         vfprintf(logfile, fmt, vargs);
    335.         fflush(logfile);

ffserver.c:334:9: 
    332.         }
    333.         print_prefix = strstr(fmt, "\n") != NULL;
    334.         vfprintf(logfile, fmt, vargs);
                 ^
    335.         fflush(logfile);
    336.     }

ffserver.c:335:9: 
    333.         print_prefix = strstr(fmt, "\n") != NULL;
    334.         vfprintf(logfile, fmt, vargs);
    335.         fflush(logfile);
                 ^
    336.     }
    337. }

ffserver.c:327:5: 
    325. {
    326.     static int print_prefix = 1;
    327.     if (logfile) {
             ^
    328.         if (print_prefix) {
    329.             char buf[32];

ffserver.c:337:1: return from a call to http_vlog
    335.         fflush(logfile);
    336.     }
    337. }
         ^
    338. 
    339. void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)

ffserver.c:344:5: 
  342.     va_start(vargs, fmt);
  343.     http_vlog(fmt, vargs);
  344.     va_end(vargs);
           ^
  345. }
  346. 

ffserver.c:345:1: return from a call to http_log
  343.     http_vlog(fmt, vargs);
  344.     va_end(vargs);
  345. }
       ^
  346. 
  347. static void http_av_log(void *ptr, int level, const char *fmt, va_list vargs)

ffserver.c:3377:13: 
3375.                 http_log("could not open %s: %d\n", stream->feed_filename, ret);
3376.                 /* remove stream (no need to spend more time on it) */
3377.             fail:
                  ^
3378.                 remove_stream(stream);
3379.             } else {

ffserver.c:3378:17: Skipping remove_stream(): empty list of specs
3376.                 /* remove stream (no need to spend more time on it) */
3377.             fail:
3378.                 remove_stream(stream);
                      ^
3379.             } else {
3380.                 /* find all the AVStreams inside and reference them in

ffserver.c:3358:48: 
3356. 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
                                                     ^
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3358:32: Loop condition is true. Entering loop body
3356. 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
                                     ^
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&

ffserver.c:3359:9: 
3357.     /* gather all streams */
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3359.         stream_next = stream->next;
              ^
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3361.             !stream->feed) {

ffserver.c:3360:13: Taking true branch
3358.     for(stream = first_stream; stream != NULL; stream = stream_next) {
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
                  ^
3361.             !stream->feed) {
3362.             /* the stream comes from a file */

ffserver.c:3361:14: Taking false branch
3359.         stream_next = stream->next;
3360.         if (stream->stream_type == STREAM_TYPE_LIVE &&
3361.             !stream->feed) {
                   ^
3362.             /* the stream comes from a file */
3363.             /* try to open the file */
