cmdutils.c:1588: error: Memory Leak
  memory dynamically allocated by call to `av_strdup()` at line 1575, column 52 is not reachable after line 1588, column 9.

cmdutils.c:1514:1: start of procedure check_stream_specifier()
1512. }
1513. 
1514. int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
      ^
1515. {
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */

cmdutils.c:1516:9: Taking false branch
1514. int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
1515. {
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */
              ^
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||

cmdutils.c:1518:14: Taking false branch
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
                   ^
1519.              *spec == 't') { /* opt:[vasdt] */
1520.         enum AVMediaType type;

cmdutils.c:1518:30: Taking false branch
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
                                   ^
1519.              *spec == 't') { /* opt:[vasdt] */
1520.         enum AVMediaType type;

cmdutils.c:1518:46: Taking false branch
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
                                                   ^
1519.              *spec == 't') { /* opt:[vasdt] */
1520.         enum AVMediaType type;

cmdutils.c:1518:62: Taking false branch
1516.     if (*spec <= '9' && *spec >= '0') /* opt:index */
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
                                                                   ^
1519.              *spec == 't') { /* opt:[vasdt] */
1520.         enum AVMediaType type;

cmdutils.c:1519:14: Taking false branch
1517.         return strtol(spec, NULL, 0) == st->index;
1518.     else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
1519.              *spec == 't') { /* opt:[vasdt] */
                   ^
1520.         enum AVMediaType type;
1521. 

cmdutils.c:1540:16: Taking false branch
1538.         }
1539.         return 1;
1540.     } else if (*spec == 'p' && *(spec + 1) == ':') {
                     ^
1541.         int prog_id, i, j;
1542.         char *endptr;

cmdutils.c:1561:16: Taking false branch
1559.         }
1560.         return 0;
1561.     } else if (*spec == 'i' && *(spec + 1) == ':') {
                     ^
1562.         int stream_id;
1563.         char *endptr;

cmdutils.c:1567:16: Taking true branch
1565.         stream_id = strtol(spec, &endptr, 0);
1566.         return stream_id == st->id;
1567.     } else if (*spec == 'm' && *(spec + 1) == ':') {
                     ^
1568.         AVDictionaryEntry *tag;
1569.         char *key, *val;

cmdutils.c:1567:32: Taking true branch
1565.         stream_id = strtol(spec, &endptr, 0);
1566.         return stream_id == st->id;
1567.     } else if (*spec == 'm' && *(spec + 1) == ':') {
                                     ^
1568.         AVDictionaryEntry *tag;
1569.         char *key, *val;

cmdutils.c:1572:9: 
1570.         int ret;
1571. 
1572.         spec += 2;
              ^
1573.         val = strchr(spec, ':');
1574. 

cmdutils.c:1573:9: 
1571. 
1572.         spec += 2;
1573.         val = strchr(spec, ':');
              ^
1574. 
1575.         key = val ? av_strndup(spec, val - spec) : av_strdup(spec);

cmdutils.c:1575:15: Condition is false
1573.         val = strchr(spec, ':');
1574. 
1575.         key = val ? av_strndup(spec, val - spec) : av_strdup(spec);
                    ^
1576.         if (!key)
1577.             return AVERROR(ENOMEM);

libavutil/mem.c:219:1: start of procedure av_strdup()
  217. }
  218. 
  219. char *av_strdup(const char *s)
       ^
  220. {
  221.     char *ptr = NULL;

libavutil/mem.c:221:5: 
  219. char *av_strdup(const char *s)
  220. {
  221.     char *ptr = NULL;
           ^
  222.     if (s) {
  223.         int len = strlen(s) + 1;

libavutil/mem.c:222:9: Taking true branch
  220. {
  221.     char *ptr = NULL;
  222.     if (s) {
               ^
  223.         int len = strlen(s) + 1;
  224.         ptr = av_realloc(NULL, len);

libavutil/mem.c:223:9: 
  221.     char *ptr = NULL;
  222.     if (s) {
  223.         int len = strlen(s) + 1;
               ^
  224.         ptr = av_realloc(NULL, len);
  225.         if (ptr)

libavutil/mem.c:224:9: 
  222.     if (s) {
  223.         int len = strlen(s) + 1;
  224.         ptr = av_realloc(NULL, len);
               ^
  225.         if (ptr)
  226.             memcpy(ptr, s, len);

libavutil/mem.c:117:1: start of procedure av_realloc()
    115. }
    116. 
    117. void *av_realloc(void *ptr, size_t size)
         ^
    118. {
    119. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:124:9: Taking false branch
    122. 
    123.     /* let's disallow possibly ambiguous cases */
    124.     if (size > (INT_MAX - 16))
                 ^
    125.         return NULL;
    126. 

libavutil/mem.c:136:5: 
    134.     return _aligned_realloc(ptr, size, 32);
    135. #else
    136.     return realloc(ptr, size);
             ^
    137. #endif
    138. }

libavutil/mem.c:138:1: return from a call to av_realloc
    136.     return realloc(ptr, size);
    137. #endif
    138. }
         ^
    139. 
    140. int av_reallocp(void *ptr, size_t size)

libavutil/mem.c:225:13: Taking true branch
  223.         int len = strlen(s) + 1;
  224.         ptr = av_realloc(NULL, len);
  225.         if (ptr)
                   ^
  226.             memcpy(ptr, s, len);
  227.     }

libavutil/mem.c:226:13: 
  224.         ptr = av_realloc(NULL, len);
  225.         if (ptr)
  226.             memcpy(ptr, s, len);
                   ^
  227.     }
  228.     return ptr;

libavutil/mem.c:228:5: 
  226.             memcpy(ptr, s, len);
  227.     }
  228.     return ptr;
           ^
  229. }
  230. 

libavutil/mem.c:229:1: return from a call to av_strdup
  227.     }
  228.     return ptr;
  229. }
       ^
  230. 
  231. char *av_strndup(const char *s, size_t len)

cmdutils.c:1575:9: 
1573.         val = strchr(spec, ':');
1574. 
1575.         key = val ? av_strndup(spec, val - spec) : av_strdup(spec);
              ^
1576.         if (!key)
1577.             return AVERROR(ENOMEM);

cmdutils.c:1576:14: Taking false branch
1574. 
1575.         key = val ? av_strndup(spec, val - spec) : av_strdup(spec);
1576.         if (!key)
                   ^
1577.             return AVERROR(ENOMEM);
1578. 

cmdutils.c:1579:9: Skipping av_dict_get(): empty list of specs
1577.             return AVERROR(ENOMEM);
1578. 
1579.         tag = av_dict_get(st->metadata, key, NULL, 0);
              ^
1580.         if (tag) {
1581.             if (!val || !strcmp(tag->value, val + 1))

cmdutils.c:1580:13: Taking true branch
1578. 
1579.         tag = av_dict_get(st->metadata, key, NULL, 0);
1580.         if (tag) {
                  ^
1581.             if (!val || !strcmp(tag->value, val + 1))
1582.                 ret = 1;

cmdutils.c:1581:18: Taking false branch
1579.         tag = av_dict_get(st->metadata, key, NULL, 0);
1580.         if (tag) {
1581.             if (!val || !strcmp(tag->value, val + 1))
                       ^
1582.                 ret = 1;
1583.             else

cmdutils.c:1581:26: Taking false branch
1579.         tag = av_dict_get(st->metadata, key, NULL, 0);
1580.         if (tag) {
1581.             if (!val || !strcmp(tag->value, val + 1))
                               ^
1582.                 ret = 1;
1583.             else

cmdutils.c:1584:17: 
1582.                 ret = 1;
1583.             else
1584.                 ret = 0;
                      ^
1585.         } else
1586.             ret = 0;

cmdutils.c:1588:9: Skipping av_freep(): empty list of specs
1586.             ret = 0;
1587. 
1588.         av_freep(&key);
              ^
1589.         return ret;
1590.     } else if (!*spec) /* empty specifier, matches everything */
