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) {
DSENTRYPROC dsEntry;
TW_IDENTITY fakeOrigin;
TW_IDENTITY sourceId;
struct all_devices *new_devices;
TW_UINT16 ret;
WCHAR path[MAX_PATH];
......@@ -89,7 +90,10 @@ twain_add_onedriver(const WCHAR *dsname) {
}
if (i < nrdevices)
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].identity = sourceId;
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