[PATCH] winebus.sys: Avoid calling strdup().
Francois Gouget
fgouget at free.fr
Thu Aug 23 09:43:28 CDT 2018
Signed-off-by: Francois Gouget <fgouget at free.fr>
---
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);
}
--
2.18.0
More information about the wine-devel
mailing list