Commit a53591ad authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

winebus.sys: Avoid calling strdup().

parent 44598d33
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include "ddk/wdm.h" #include "ddk/wdm.h"
#include "ddk/hidtypes.h" #include "ddk/hidtypes.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#ifdef HAS_PROPER_INPUT_HEADER #ifdef HAS_PROPER_INPUT_HEADER
...@@ -1046,7 +1047,7 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id, ...@@ -1046,7 +1047,7 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id,
DWORD *product_id, WCHAR **serial_number) DWORD *product_id, WCHAR **serial_number)
{ {
DWORD bus_type; DWORD bus_type;
char *tmp = strdup(uevent); char *tmp;
char *saveptr = NULL; char *saveptr = NULL;
char *line; char *line;
char *key; char *key;
...@@ -1055,6 +1056,8 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id, ...@@ -1055,6 +1056,8 @@ static int parse_uevent_info(const char *uevent, DWORD *vendor_id,
int found_id = 0; int found_id = 0;
int found_serial = 0; int found_serial = 0;
tmp = heap_alloc(strlen(uevent) + 1);
strcpy(tmp, uevent);
line = strtok_r(tmp, "\n", &saveptr); line = strtok_r(tmp, "\n", &saveptr);
while (line != NULL) while (line != NULL)
{ {
...@@ -1092,7 +1095,7 @@ next_line: ...@@ -1092,7 +1095,7 @@ next_line:
line = strtok_r(NULL, "\n", &saveptr); line = strtok_r(NULL, "\n", &saveptr);
} }
free(tmp); heap_free(tmp);
return (found_id && found_serial); return (found_id && found_serial);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment