You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/id3v2: Avoid av_strdup for key and value of dict
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
8d5f9daacd
commit
a7245adee3
@@ -361,8 +361,8 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
|
|||||||
{
|
{
|
||||||
uint8_t lang[4];
|
uint8_t lang[4];
|
||||||
uint8_t *descriptor = NULL; // 'Content descriptor'
|
uint8_t *descriptor = NULL; // 'Content descriptor'
|
||||||
uint8_t *text = NULL;
|
uint8_t *text;
|
||||||
char *key = NULL;
|
char *key;
|
||||||
int encoding;
|
int encoding;
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
|
||||||
@@ -387,18 +387,19 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
|
|||||||
key = av_asprintf("lyrics-%s%s%s", descriptor[0] ? (char *)descriptor : "",
|
key = av_asprintf("lyrics-%s%s%s", descriptor[0] ? (char *)descriptor : "",
|
||||||
descriptor[0] ? "-" : "",
|
descriptor[0] ? "-" : "",
|
||||||
lang);
|
lang);
|
||||||
if (!key)
|
if (!key) {
|
||||||
|
av_free(text);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
av_dict_set(metadata, key, text, 0);
|
av_dict_set(metadata, key, text,
|
||||||
|
AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
|
||||||
|
|
||||||
ok = 1;
|
ok = 1;
|
||||||
error:
|
error:
|
||||||
if (!ok)
|
if (!ok)
|
||||||
av_log(s, AV_LOG_ERROR, "Error reading lyrics, skipped\n");
|
av_log(s, AV_LOG_ERROR, "Error reading lyrics, skipped\n");
|
||||||
av_free(descriptor);
|
av_free(descriptor);
|
||||||
av_free(text);
|
|
||||||
av_free(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user