Merge commit 'a6653787a4b1e89170ff7962312dd110769c83a3'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Feb 2015 22:34:10 +0000 (23:34 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Feb 2015 22:35:08 +0000 (23:35 +0100)
* commit 'a6653787a4b1e89170ff7962312dd110769c83a3':
  libopencv: Check kernel_str life cycle

Conflicts:
libavfilter/vf_libopencv.c

See: f16a6f667c993a158643b52815ec42961508b0a9
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavfilter/vf_libopencv.c

@@@ -265,18 -265,23 +265,23 @@@ static av_cold int dilate_init(AVFilter
      const char *buf = args;
      int ret;
  
-     if (args)
 -    dilate->nb_iterations = 1;
 -
+     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;
  
 -    sscanf(buf, "|%d", &dilate->nb_iterations);
 +    if (!buf || sscanf(buf, "|%d", &dilate->nb_iterations) != 1)
 +        dilate->nb_iterations = 1;
      av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations);
      if (dilate->nb_iterations <= 0) {
          av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n",