Browse code

lavfi/concat: prefer av_asprintf() over stack allocated buffer.

Clément Bœsch authored on 2012/11/29 20:25:02
Showing 1 changed files
... ...
@@ -24,6 +24,7 @@
24 24
  */
25 25
 
26 26
 #include "libavutil/avassert.h"
27
+#include "libavutil/avstring.h"
27 28
 #include "libavutil/channel_layout.h"
28 29
 #include "libavutil/opt.h"
29 30
 #include "avfilter.h"
... ...
@@ -344,7 +345,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
344 344
     ConcatContext *cat = ctx->priv;
345 345
     int ret;
346 346
     unsigned seg, type, str;
347
-    char name[32];
348 347
 
349 348
     cat->class = &concat_class;
350 349
     av_opt_set_defaults(cat);
... ...
@@ -365,8 +365,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
365 365
                     .get_audio_buffer = get_audio_buffer,
366 366
                     .filter_frame     = filter_frame,
367 367
                 };
368
-                snprintf(name, sizeof(name), "in%d:%c%d", seg, "va"[type], str);
369
-                pad.name = av_strdup(name);
368
+                pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str);
370 369
                 ff_insert_inpad(ctx, ctx->nb_inputs, &pad);
371 370
             }
372 371
         }
... ...
@@ -379,8 +378,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
379 379
                 .config_props  = config_output,
380 380
                 .request_frame = request_frame,
381 381
             };
382
-            snprintf(name, sizeof(name), "out:%c%d", "va"[type], str);
383
-            pad.name = av_strdup(name);
382
+            pad.name = av_asprintf("out:%c%d", "va"[type], str);
384 383
             ff_insert_outpad(ctx, ctx->nb_outputs, &pad);
385 384
         }
386 385
     }