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
@ -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…
x
Reference in New Issue
Block a user