From a53591ad3cd5a7e549451587fd2b6a696da2c109 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Thu, 23 Aug 2018 16:43:28 +0200 Subject: [PATCH] winebus.sys: Avoid calling strdup(). Signed-off-by: Francois Gouget Signed-off-by: Alexandre Julliard --- dlls/winebus.sys/bus_udev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index d34e18c71c7..788b564851e 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -65,6 +65,7 @@ #include "ddk/wdm.h" #include "ddk/hidtypes.h" #include "wine/debug.h" +#include "wine/heap.h" #include "wine/unicode.h" #ifdef HAS_PROPER_INPUT_HEADER @@ -1046,7 +1047,7 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id, DWORD *product_id, WCHAR **serial_number) { DWORD bus_type; - char *tmp = strdup(uevent); + char *tmp; char *saveptr = NULL; char *line; char *key; @@ -1055,6 +1056,8 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id, int found_id = 0; int found_serial = 0; + tmp = heap_alloc(strlen(uevent) + 1); + strcpy(tmp, uevent); line = strtok_r(tmp, "\n", &saveptr); while (line != NULL) { @@ -1092,7 +1095,7 @@ next_line: line = strtok_r(NULL, "\n", &saveptr); } - free(tmp); + heap_free(tmp); return (found_id && found_serial); }