summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-03-22 23:03:21 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2020-03-23 23:37:19 +0100
commit750a81ba990ba8592d3fa4f713ab8f47b33b8de5 (patch)
treed313c45e71f67f35298538d0ccc12885d70a2376 /libavformat/mxfdec.c
parent2465fe1302f2c87b37496a00ab490061a2a7ce03 (diff)
avformat/mxfdec: use av_asprintf()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9113e2a09c..3374f36a88 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2017,7 +2017,7 @@ static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *stro
static int mxf_parse_package_comments(MXFContext *mxf, AVDictionary **pm, MXFPackage *package)
{
MXFTaggedValue *tag;
- int size, i;
+ int i;
char *key = NULL;
for (i = 0; i < package->comment_count; i++) {
@@ -2025,12 +2025,10 @@ static int mxf_parse_package_comments(MXFContext *mxf, AVDictionary **pm, MXFPac
if (!tag || !tag->name || !tag->value)
continue;
- size = strlen(tag->name) + 8 + 1;
- key = av_mallocz(size);
+ key = av_asprintf("comment_%s", tag->name);
if (!key)
return AVERROR(ENOMEM);
- snprintf(key, size, "comment_%s", tag->name);
av_dict_set(pm, key, tag->value, AV_DICT_DONT_STRDUP_KEY);
}
return 0;