USB HID: Fix a memory leak.

Replace mismatched g_strdup() + g_free()s with
wmem_strdup_printf(wmem_packet_scope(), ...). Fixes #17124.


(cherry picked from commit 26f0db01a7)
This commit is contained in:
Gerald Combs 2021-01-25 20:38:26 +00:00
parent 2248cba00c
commit 24f56bec53
1 changed files with 1 additions and 3 deletions

View File

@ -3715,7 +3715,7 @@ get_usage_page_item_string(guint32 usage_page, guint32 id)
if (!str)
str = "Reserved";
return g_strdup_printf(str, id);
return wmem_strdup_printf(wmem_packet_scope(), str, id);
}
/* Dissector for the data in a HID main report. */
@ -3940,8 +3940,6 @@ dissect_usb_hid_report_localitem_data(packet_info *pinfo _U_, proto_tree *tree,
}
offset += bSize;
g_free(str);
return offset;
}