Commit 3e5a9565 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

twain_32: Handle realloc failure in twain_add_onedriver (cppcheck).

parent 89f1d626
...@@ -53,6 +53,7 @@ twain_add_onedriver(const WCHAR *dsname) { ...@@ -53,6 +53,7 @@ twain_add_onedriver(const WCHAR *dsname) {
DSENTRYPROC dsEntry; DSENTRYPROC dsEntry;
TW_IDENTITY fakeOrigin; TW_IDENTITY fakeOrigin;
TW_IDENTITY sourceId; TW_IDENTITY sourceId;
struct all_devices *new_devices;
TW_UINT16 ret; TW_UINT16 ret;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
...@@ -89,7 +90,10 @@ twain_add_onedriver(const WCHAR *dsname) { ...@@ -89,7 +90,10 @@ twain_add_onedriver(const WCHAR *dsname) {
} }
if (i < nrdevices) if (i < nrdevices)
break; break;
devices = realloc( devices, sizeof(devices[0])*(nrdevices+1) ); new_devices = realloc( devices, sizeof(devices[0]) * (nrdevices + 1) );
if (!new_devices)
break;
devices = new_devices;
devices[nrdevices].modname = wcsdup( path ); devices[nrdevices].modname = wcsdup( path );
devices[nrdevices].identity = sourceId; devices[nrdevices].identity = sourceId;
nrdevices++; nrdevices++;
......
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