gbookmarkfile: Fix some minor leaks when metadata elements are repeated

oss-fuzz#9674

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2018-08-02 11:20:15 +01:00
parent 433770b681
commit 6c041ff283
3 changed files with 7 additions and 2 deletions

View File

@ -915,7 +915,8 @@ parse_mime_type_element (GMarkupParseContext *context,
if (!item->metadata)
item->metadata = bookmark_metadata_new ();
g_free (item->metadata->mime_type);
item->metadata->mime_type = g_strdup (type);
}
@ -964,7 +965,9 @@ parse_icon_element (GMarkupParseContext *context,
if (!item->metadata)
item->metadata = bookmark_metadata_new ();
g_free (item->metadata->icon_href);
g_free (item->metadata->icon_mime);
item->metadata->icon_href = g_strdup (href);
item->metadata->icon_mime = g_strdup (type);
}

View File

@ -164,6 +164,7 @@ dist_test_data += \
bookmarks/fail-36.xbel \
bookmarks/fail-37.xbel \
bookmarks/fail-38.xbel \
bookmarks/fail-39.xbel \
bookmarks/valid-01.xbel \
bookmarks/valid-02.xbel \
bookmarks/valid-03.xbel \

View File

@ -0,0 +1 @@
<xbel version="1.0"><bookmark href=""><info><metadata owner="http://freedesktop.org"><mime-type/><mime-type/