Francois Gouget : winebus.sys: Avoid calling strdup().
Alexandre Julliard
julliard at winehq.org
Thu Aug 23 16:37:04 CDT 2018
Module: wine
Branch: master
Commit: a53591ad3cd5a7e549451587fd2b6a696da2c109
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a53591ad3cd5a7e549451587fd2b6a696da2c109
Author: Francois Gouget <fgouget at free.fr>
Date: Thu Aug 23 16:43:28 2018 +0200
winebus.sys: Avoid calling strdup().
Signed-off-by: Francois Gouget <fgouget at free.fr>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 d34e18c..788b564 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);
}
More information about the wine-cvs
mailing list