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>
This commit is contained in:
Limin Wang 2020-03-22 23:03:21 +08:00 committed by Michael Niedermayer
parent 2465fe1302
commit 750a81ba99
1 changed files with 2 additions and 4 deletions

View File

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