mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
metadata: don't copy trailing NULL of strings in xmp metadata
Also useing g_strdup, fixes the malloc <-> g_free mismatch.
This commit is contained in:
parent
b7b8b7f407
commit
27683ead16
1 changed files with 3 additions and 4 deletions
|
@ -385,11 +385,10 @@ metadatamux_xmp_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
|
||||||
if (!xmp_serialize (xmp, xmp_str_buf, 0, 2)) {
|
if (!xmp_serialize (xmp, xmp_str_buf, 0, 2)) {
|
||||||
GST_ERROR ("failed to serialize xmp into chunk\n");
|
GST_ERROR ("failed to serialize xmp into chunk\n");
|
||||||
} else if (xmp_str_buf) {
|
} else if (xmp_str_buf) {
|
||||||
unsigned int len = strlen (xmp_string_cstr (xmp_str_buf));
|
const gchar *text = xmp_string_cstr (xmp_str_buf);
|
||||||
|
|
||||||
*size = len + 1;
|
*buf = (guint8 *) g_strdup (text);
|
||||||
*buf = malloc (*size);
|
*size = strlen (text);
|
||||||
memcpy (*buf, xmp_string_cstr (xmp_str_buf), *size);
|
|
||||||
} else {
|
} else {
|
||||||
GST_ERROR ("failed to serialize xmp into chunk\n");
|
GST_ERROR ("failed to serialize xmp into chunk\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue