Merge commit 'a6653787a4b1e89170ff7962312dd110769c83a3'

* commit 'a6653787a4b1e89170ff7962312dd110769c83a3':
  libopencv: Check kernel_str life cycle

Conflicts:
	libavfilter/vf_libopencv.c

See: f16a6f667c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-03 23:34:10 +01:00
commit 1dc1c4e7a8

View File

@ -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;