libavfilter/avfilter.c:702: error: Memory Leak
  memory dynamically allocated by call to `av_strdup()` at line 669, column 26 is not reachable after line 702, column 13.

libavfilter/avfilter.c:613:1: start of procedure avfilter_init_str()
611. }
612. 
613. int avfilter_init_str(AVFilterContext *filter, const char *args)
     ^
614. {
615.     AVDictionary *options = NULL;

libavfilter/avfilter.c:615:5: 
613. int avfilter_init_str(AVFilterContext *filter, const char *args)
614. {
615.     AVDictionary *options = NULL;
         ^
616.     AVDictionaryEntry *e;
617.     int ret = 0;

libavfilter/avfilter.c:617:5: 
615.     AVDictionary *options = NULL;
616.     AVDictionaryEntry *e;
617.     int ret = 0;
         ^
618. 
619.     if (args && *args) {

libavfilter/avfilter.c:619:9: Taking true branch
617.     int ret = 0;
618. 
619.     if (args && *args) {
             ^
620.         if (!filter->filter->priv_class) {
621.             av_log(filter, AV_LOG_ERROR, "This filter does not take any "

libavfilter/avfilter.c:619:17: Taking true branch
617.     int ret = 0;
618. 
619.     if (args && *args) {
                     ^
620.         if (!filter->filter->priv_class) {
621.             av_log(filter, AV_LOG_ERROR, "This filter does not take any "

libavfilter/avfilter.c:620:14: Taking false branch
618. 
619.     if (args && *args) {
620.         if (!filter->filter->priv_class) {
                  ^
621.             av_log(filter, AV_LOG_ERROR, "This filter does not take any "
622.                    "options, but options were provided: %s.\n", args);

libavfilter/avfilter.c:627:14: Taking false branch
625. 
626. #if FF_API_OLD_FILTER_OPTS
627.         if (!strcmp(filter->filter->name, "scale") &&
                  ^
628.             strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
629.             /* old w:h:flags=<flags> syntax */

libavfilter/avfilter.c:656:13: Taking false branch
654. #endif
655. 
656.         if (strchr(args, '=')) {
                 ^
657.             /* assume a list of key1=value1:key2=value2:... */
658.             ret = av_dict_parse_string(&options, args, "=", ":", 0);

libavfilter/avfilter.c:662:21: Taking false branch
660.                 goto fail;
661. #if FF_API_OLD_FILTER_OPTS
662.         } else if (!strcmp(filter->filter->name, "format")     ||
                         ^
663.                    !strcmp(filter->filter->name, "noformat")   ||
664.                    !strcmp(filter->filter->name, "frei0r")     ||

libavfilter/avfilter.c:663:21: Taking false branch
661. #if FF_API_OLD_FILTER_OPTS
662.         } else if (!strcmp(filter->filter->name, "format")     ||
663.                    !strcmp(filter->filter->name, "noformat")   ||
                         ^
664.                    !strcmp(filter->filter->name, "frei0r")     ||
665.                    !strcmp(filter->filter->name, "frei0r_src") ||

libavfilter/avfilter.c:664:21: Taking false branch
662.         } else if (!strcmp(filter->filter->name, "format")     ||
663.                    !strcmp(filter->filter->name, "noformat")   ||
664.                    !strcmp(filter->filter->name, "frei0r")     ||
                         ^
665.                    !strcmp(filter->filter->name, "frei0r_src") ||
666.                    !strcmp(filter->filter->name, "ocv")) {

libavfilter/avfilter.c:665:21: Taking false branch
663.                    !strcmp(filter->filter->name, "noformat")   ||
664.                    !strcmp(filter->filter->name, "frei0r")     ||
665.                    !strcmp(filter->filter->name, "frei0r_src") ||
                         ^
666.                    !strcmp(filter->filter->name, "ocv")) {
667.             /* a hack for compatibility with the old syntax

libavfilter/avfilter.c:666:21: Taking true branch
664.                    !strcmp(filter->filter->name, "frei0r")     ||
665.                    !strcmp(filter->filter->name, "frei0r_src") ||
666.                    !strcmp(filter->filter->name, "ocv")) {
                         ^
667.             /* a hack for compatibility with the old syntax
668.              * replace colons with |s */

libavfilter/avfilter.c:669:13: 
667.             /* a hack for compatibility with the old syntax
668.              * replace colons with |s */
669.             char *copy = av_strdup(args);
                 ^
670.             char *p    = copy;
671.             int nb_leading = 0; // number of leading colons to skip

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)

libavfilter/avfilter.c:670:13: 
668.              * replace colons with |s */
669.             char *copy = av_strdup(args);
670.             char *p    = copy;
                 ^
671.             int nb_leading = 0; // number of leading colons to skip
672. 

libavfilter/avfilter.c:671:13: 
669.             char *copy = av_strdup(args);
670.             char *p    = copy;
671.             int nb_leading = 0; // number of leading colons to skip
                 ^
672. 
673.             if (!copy) {

libavfilter/avfilter.c:673:18: Taking false branch
671.             int nb_leading = 0; // number of leading colons to skip
672. 
673.             if (!copy) {
                      ^
674.                 ret = AVERROR(ENOMEM);
675.                 goto fail;

libavfilter/avfilter.c:678:18: Taking false branch
676.             }
677. 
678.             if (!strcmp(filter->filter->name, "frei0r") ||
                      ^
679.                 !strcmp(filter->filter->name, "ocv"))
680.                 nb_leading = 1;

libavfilter/avfilter.c:679:18: Taking false branch
677. 
678.             if (!strcmp(filter->filter->name, "frei0r") ||
679.                 !strcmp(filter->filter->name, "ocv"))
                      ^
680.                 nb_leading = 1;
681.             else if (!strcmp(filter->filter->name, "frei0r_src"))

libavfilter/avfilter.c:681:23: Taking false branch
679.                 !strcmp(filter->filter->name, "ocv"))
680.                 nb_leading = 1;
681.             else if (!strcmp(filter->filter->name, "frei0r_src"))
                           ^
682.                 nb_leading = 3;
683. 

libavfilter/avfilter.c:684:20: Loop condition is false. Leaving loop
682.                 nb_leading = 3;
683. 
684.             while (nb_leading--) {
                        ^
685.                 p = strchr(p, ':');
686.                 if (!p) {

libavfilter/avfilter.c:693:17: Taking true branch
691.             }
692. 
693.             if (strchr(p, ':')) {
                     ^
694.                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
695.                        "'|' to separate the list items.\n");

libavfilter/avfilter.c:694:17: Skipping av_log(): empty list of specs
692. 
693.             if (strchr(p, ':')) {
694.                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
                     ^
695.                        "'|' to separate the list items.\n");
696.             }

libavfilter/avfilter.c:698:21: Loop condition is false. Leaving loop
696.             }
697. 
698.             while ((p = strchr(p, ':')))
                         ^
699.                 *p++ = '|';
700. 

libavfilter/avfilter.c:701:13: Skipping process_unnamed_options(): empty list of specs
699.                 *p++ = '|';
700. 
701.             ret = process_unnamed_options(filter, &options, copy);
                 ^
702.             av_freep(&copy);
703. 

libavfilter/avfilter.c:702:13: Skipping av_freep(): empty list of specs
700. 
701.             ret = process_unnamed_options(filter, &options, copy);
702.             av_freep(&copy);
                 ^
703. 
704.             if (ret < 0)

int avfilter_init_str(AVFilterContext *filter, const char *args)
{
    AVDictionary *options = NULL;
    AVDictionaryEntry *e;
    int ret = 0;
    if (args && *args) {
        if (!filter->filter->priv_class) {
            av_log(filter, AV_LOG_ERROR, "This filter does not take any "
                   "options, but options were provided: %s.\n", args);
            return AVERROR(EINVAL);
        }
#if FF_API_OLD_FILTER_OPTS
        if (!strcmp(filter->filter->name, "scale") &&
            strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
            char *copy = av_strdup(args);
            char *p;
            av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option "
                   "syntax is deprecated. Use either <w>:<h>:<flags> or "
                   "w=<w>:h=<h>:flags=<flags>.\n");
            if (!copy) {
                ret = AVERROR(ENOMEM);
                goto fail;
            }
            p = strrchr(copy, ':');
            if (p) {
                *p++ = 0;
                ret = av_dict_parse_string(&options, p, "=", ":", 0);
            }
            if (ret >= 0)
                ret = process_unnamed_options(filter, &options, copy);
            av_freep(&copy);
            if (ret < 0)
                goto fail;
        } else
#endif
        if (strchr(args, '=')) {
            ret = av_dict_parse_string(&options, args, "=", ":", 0);
            if (ret < 0)
                goto fail;
#if FF_API_OLD_FILTER_OPTS
        } else if (!strcmp(filter->filter->name, "format")     ||
                   !strcmp(filter->filter->name, "noformat")   ||
                   !strcmp(filter->filter->name, "frei0r")     ||
                   !strcmp(filter->filter->name, "frei0r_src") ||
                   !strcmp(filter->filter->name, "ocv")) {
            char *copy = av_strdup(args);
            char *p    = copy;
            int nb_leading = 0;
            if (!copy) {
                ret = AVERROR(ENOMEM);
                goto fail;
            }
            if (!strcmp(filter->filter->name, "frei0r") ||
                !strcmp(filter->filter->name, "ocv"))
                nb_leading = 1;
            else if (!strcmp(filter->filter->name, "frei0r_src"))
                nb_leading = 3;
            while (nb_leading--) {
                p = strchr(p, ':');
                if (!p) {
                    p = copy + strlen(copy);
                    break;
                }
                p++;
            }
            if (strchr(p, ':')) {
                av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
                       "'|' to separate the list items.\n");
            }
            while ((p = strchr(p, ':')))
                *p++ = '|';
            ret = process_unnamed_options(filter, &options, copy);
            av_freep(&copy);
            if (ret < 0)
                goto fail;
#endif
        } else {
            ret = process_unnamed_options(filter, &options, args);
            if (ret < 0)
                goto fail;
        }
    }
    ret = avfilter_init_dict(filter, &options);
    if (ret < 0)
        goto fail;
    if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
        av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key);
        ret = AVERROR_OPTION_NOT_FOUND;
        goto fail;
    }
fail:
    av_dict_free(&options);
    return ret;
}
['int avfilter_init_str(AVFilterContext *filter, const char *args)\n{\n    AVDictionary *options = NULL;\n    AVDictionaryEntry *e;\n    int ret = 0;\n    if (args && *args) {\n        if (!filter->filter->priv_class) {\n            av_log(filter, AV_LOG_ERROR, "This filter does not take any "\n                   "options, but options were provided: %s.\\n", args);\n            return AVERROR(EINVAL);\n        }\n#if FF_API_OLD_FILTER_OPTS\n        if (!strcmp(filter->filter->name, "scale") &&\n            strchr(args, \':\') && strchr(args, \':\') < strchr(args, \'=\')) {\n            char *copy = av_strdup(args);\n            char *p;\n            av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option "\n                   "syntax is deprecated. Use either <w>:<h>:<flags> or "\n                   "w=<w>:h=<h>:flags=<flags>.\\n");\n            if (!copy) {\n                ret = AVERROR(ENOMEM);\n                goto fail;\n            }\n            p = strrchr(copy, \':\');\n            if (p) {\n                *p++ = 0;\n                ret = av_dict_parse_string(&options, p, "=", ":", 0);\n            }\n            if (ret >= 0)\n                ret = process_unnamed_options(filter, &options, copy);\n            av_freep(&copy);\n            if (ret < 0)\n                goto fail;\n        } else\n#endif\n        if (strchr(args, \'=\')) {\n            ret = av_dict_parse_string(&options, args, "=", ":", 0);\n            if (ret < 0)\n                goto fail;\n#if FF_API_OLD_FILTER_OPTS\n        } else if (!strcmp(filter->filter->name, "format")     ||\n                   !strcmp(filter->filter->name, "noformat")   ||\n                   !strcmp(filter->filter->name, "frei0r")     ||\n                   !strcmp(filter->filter->name, "frei0r_src") ||\n                   !strcmp(filter->filter->name, "ocv")) {\n            char *copy = av_strdup(args);\n            char *p    = copy;\n            int nb_leading = 0;\n            if (!copy) {\n                ret = AVERROR(ENOMEM);\n                goto fail;\n            }\n            if (!strcmp(filter->filter->name, "frei0r") ||\n                !strcmp(filter->filter->name, "ocv"))\n                nb_leading = 1;\n            else if (!strcmp(filter->filter->name, "frei0r_src"))\n                nb_leading = 3;\n            while (nb_leading--) {\n                p = strchr(p, \':\');\n                if (!p) {\n                    p = copy + strlen(copy);\n                    break;\n                }\n                p++;\n            }\n            if (strchr(p, \':\')) {\n                av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "\n                       "\'|\' to separate the list items.\\n");\n            }\n            while ((p = strchr(p, \':\')))\n                *p++ = \'|\';\n            ret = process_unnamed_options(filter, &options, copy);\n            av_freep(&copy);\n            if (ret < 0)\n                goto fail;\n#endif\n        } else {\n            ret = process_unnamed_options(filter, &options, args);\n            if (ret < 0)\n                goto fail;\n        }\n    }\n    ret = avfilter_init_dict(filter, &options);\n    if (ret < 0)\n        goto fail;\n    if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {\n        av_log(filter, AV_LOG_ERROR, "No such option: %s.\\n", e->key);\n        ret = AVERROR_OPTION_NOT_FOUND;\n        goto fail;\n    }\nfail:\n    av_dict_free(&options);\n    return ret;\n}', 'char *av_strdup(const char *s)\n{\n    char *ptr = NULL;\n    if (s) {\n        int len = strlen(s) + 1;\n        ptr = av_realloc(NULL, len);\n        if (ptr)\n            memcpy(ptr, s, len);\n    }\n    return ptr;\n}', 'void *av_realloc(void *ptr, size_t size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if (size > (INT_MAX - 16))\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if (!ptr)\n        return av_malloc(size);\n    diff = ((char *)ptr)[-1];\n    return (char *)realloc((char *)ptr - diff, size + diff) + diff;\n#elif HAVE_ALIGNED_MALLOC\n    return _aligned_realloc(ptr, size, 32);\n#else\n    return realloc(ptr, size);\n#endif\n}']