diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-03 23:34:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-03 23:35:08 +0100 |
commit | 1dc1c4e7a82edb13420f064890fbde3751ca18c9 (patch) | |
tree | 753d0901163e607d9a4ecb73b19b3f88e0af2399 /libavfilter | |
parent | 741b56fceece2b2de53466b952ed60b61544cc60 (diff) | |
parent | a6653787a4b1e89170ff7962312dd110769c83a3 (diff) | |
download | ffmpeg-1dc1c4e7a82edb13420f064890fbde3751ca18c9.tar.gz |
Merge commit 'a6653787a4b1e89170ff7962312dd110769c83a3'
* commit 'a6653787a4b1e89170ff7962312dd110769c83a3':
libopencv: Check kernel_str life cycle
Conflicts:
libavfilter/vf_libopencv.c
See: f16a6f667c993a158643b52815ec42961508b0a9
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_libopencv.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 1db9aa5b6b..af80429751 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -261,19 +261,24 @@ static av_cold int dilate_init(AVFilterContext *ctx, const char *args) OCVContext *s = ctx->priv; DilateContext *dilate = s->priv; char default_kernel_str[] = "3x3+0x0/rect"; - char *kernel_str; + char *kernel_str = NULL; const char *buf = args; int ret; - if (args) + if (args) { kernel_str = av_get_token(&buf, "|"); - else - kernel_str = av_strdup(default_kernel_str); - if (!kernel_str) - return AVERROR(ENOMEM); - if ((ret = parse_iplconvkernel(&dilate->kernel, kernel_str, ctx)) < 0) - return ret; + + if (!kernel_str) + return AVERROR(ENOMEM); + } + + ret = parse_iplconvkernel(&dilate->kernel, + (!kernel_str || !*kernel_str) ? default_kernel_str + : kernel_str, + ctx); av_free(kernel_str); + if (ret < 0) + return ret; if (!buf || sscanf(buf, "|%d", &dilate->nb_iterations) != 1) dilate->nb_iterations = 1; |