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

libavfilter/avfilter.c:602:1: start of procedure avfilter_init_str()
600. }
601. 
602. int avfilter_init_str(AVFilterContext *filter, const char *args)
     ^
603. {
604.     AVDictionary *options = NULL;

libavfilter/avfilter.c:604:5: 
602. int avfilter_init_str(AVFilterContext *filter, const char *args)
603. {
604.     AVDictionary *options = NULL;
         ^
605.     AVDictionaryEntry *e;
606.     int ret = 0;

libavfilter/avfilter.c:606:5: 
604.     AVDictionary *options = NULL;
605.     AVDictionaryEntry *e;
606.     int ret = 0;
         ^
607. 
608.     if (args && *args) {

libavfilter/avfilter.c:608:9: Taking true branch
606.     int ret = 0;
607. 
608.     if (args && *args) {
             ^
609.         if (!filter->filter->priv_class) {
610.             av_log(filter, AV_LOG_ERROR, "This filter does not take any "

libavfilter/avfilter.c:608:17: Taking true branch
606.     int ret = 0;
607. 
608.     if (args && *args) {
                     ^
609.         if (!filter->filter->priv_class) {
610.             av_log(filter, AV_LOG_ERROR, "This filter does not take any "

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

libavfilter/avfilter.c:616:14: Taking false branch
614. 
615. #if FF_API_OLD_FILTER_OPTS
616.         if (!strcmp(filter->filter->name, "scale") &&
                  ^
617.             strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
618.             /* old w:h:flags=<flags> syntax */

libavfilter/avfilter.c:645:13: Taking false branch
643. #endif
644. 
645.         if (strchr(args, '=')) {
                 ^
646.             /* assume a list of key1=value1:key2=value2:... */
647.             ret = av_dict_parse_string(&options, args, "=", ":", 0);

libavfilter/avfilter.c:651:21: Taking false branch
649.                 goto fail;
650. #if FF_API_OLD_FILTER_OPTS
651.         } else if (!strcmp(filter->filter->name, "format")     ||
                         ^
652.                    !strcmp(filter->filter->name, "noformat")   ||
653.                    !strcmp(filter->filter->name, "frei0r")     ||

libavfilter/avfilter.c:652:21: Taking false branch
650. #if FF_API_OLD_FILTER_OPTS
651.         } else if (!strcmp(filter->filter->name, "format")     ||
652.                    !strcmp(filter->filter->name, "noformat")   ||
                         ^
653.                    !strcmp(filter->filter->name, "frei0r")     ||
654.                    !strcmp(filter->filter->name, "frei0r_src") ||

libavfilter/avfilter.c:653:21: Taking false branch
651.         } else if (!strcmp(filter->filter->name, "format")     ||
652.                    !strcmp(filter->filter->name, "noformat")   ||
653.                    !strcmp(filter->filter->name, "frei0r")     ||
                         ^
654.                    !strcmp(filter->filter->name, "frei0r_src") ||
655.                    !strcmp(filter->filter->name, "ocv")) {

libavfilter/avfilter.c:654:21: Taking false branch
652.                    !strcmp(filter->filter->name, "noformat")   ||
653.                    !strcmp(filter->filter->name, "frei0r")     ||
654.                    !strcmp(filter->filter->name, "frei0r_src") ||
                         ^
655.                    !strcmp(filter->filter->name, "ocv")) {
656.             /* a hack for compatibility with the old syntax

libavfilter/avfilter.c:655:21: Taking true branch
653.                    !strcmp(filter->filter->name, "frei0r")     ||
654.                    !strcmp(filter->filter->name, "frei0r_src") ||
655.                    !strcmp(filter->filter->name, "ocv")) {
                         ^
656.             /* a hack for compatibility with the old syntax
657.              * replace colons with |s */

libavfilter/avfilter.c:658:13: 
656.             /* a hack for compatibility with the old syntax
657.              * replace colons with |s */
658.             char *copy = av_strdup(args);
                 ^
659.             char *p    = copy;
660.             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:659:13: 
657.              * replace colons with |s */
658.             char *copy = av_strdup(args);
659.             char *p    = copy;
                 ^
660.             int nb_leading = 0; // number of leading colons to skip
661. 

libavfilter/avfilter.c:660:13: 
658.             char *copy = av_strdup(args);
659.             char *p    = copy;
660.             int nb_leading = 0; // number of leading colons to skip
                 ^
661. 
662.             if (!copy) {

libavfilter/avfilter.c:662:18: Taking false branch
660.             int nb_leading = 0; // number of leading colons to skip
661. 
662.             if (!copy) {
                      ^
663.                 ret = AVERROR(ENOMEM);
664.                 goto fail;

libavfilter/avfilter.c:667:18: Taking false branch
665.             }
666. 
667.             if (!strcmp(filter->filter->name, "frei0r") ||
                      ^
668.                 !strcmp(filter->filter->name, "ocv"))
669.                 nb_leading = 1;

libavfilter/avfilter.c:668:18: Taking false branch
666. 
667.             if (!strcmp(filter->filter->name, "frei0r") ||
668.                 !strcmp(filter->filter->name, "ocv"))
                      ^
669.                 nb_leading = 1;
670.             else if (!strcmp(filter->filter->name, "frei0r_src"))

libavfilter/avfilter.c:670:23: Taking false branch
668.                 !strcmp(filter->filter->name, "ocv"))
669.                 nb_leading = 1;
670.             else if (!strcmp(filter->filter->name, "frei0r_src"))
                           ^
671.                 nb_leading = 3;
672. 

libavfilter/avfilter.c:673:20: Loop condition is false. Leaving loop
671.                 nb_leading = 3;
672. 
673.             while (nb_leading--) {
                        ^
674.                 p = strchr(p, ':');
675.                 if (!p) {

libavfilter/avfilter.c:682:17: Taking true branch
680.             }
681. 
682.             if (strchr(p, ':')) {
                     ^
683.                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
684.                        "'|' to separate the list items.\n");

libavfilter/avfilter.c:683:17: Skipping av_log(): empty list of specs
681. 
682.             if (strchr(p, ':')) {
683.                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
                     ^
684.                        "'|' to separate the list items.\n");
685.             }

libavfilter/avfilter.c:687:21: Loop condition is false. Leaving loop
685.             }
686. 
687.             while ((p = strchr(p, ':')))
                         ^
688.                 *p++ = '|';
689. 

libavfilter/avfilter.c:690:13: Skipping process_unnamed_options(): empty list of specs
688.                 *p++ = '|';
689. 
690.             ret = process_unnamed_options(filter, &options, copy);
                 ^
691.             av_freep(&copy);
692. 

libavfilter/avfilter.c:691:13: Skipping av_freep(): empty list of specs
689. 
690.             ret = process_unnamed_options(filter, &options, copy);
691.             av_freep(&copy);
                 ^
692. 
693.             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}']