Andrew Talbot : twain_32: Replace realloc() and strdup().

Alexandre Julliard julliard at winehq.org
Mon Feb 16 09:35:13 CST 2009


Module: wine
Branch: master
Commit: 820981b39d095ed8a5f5ec055cccef4855d31352
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=820981b39d095ed8a5f5ec055cccef4855d31352

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Sat Feb 14 17:47:28 2009 +0000

twain_32: Replace realloc() and strdup().

---

 dlls/twain_32/dsm_ctrl.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/twain_32/dsm_ctrl.c b/dlls/twain_32/dsm_ctrl.c
index 325b49d..e0d0983 100644
--- a/dlls/twain_32/dsm_ctrl.c
+++ b/dlls/twain_32/dsm_ctrl.c
@@ -84,10 +84,11 @@ twain_add_onedriver(const char *dsname) {
 		if (i < nrdevices)
 			break;
 		if (nrdevices)
-			devices = realloc(devices, sizeof(devices[0])*(nrdevices+1));
+			devices = HeapReAlloc(GetProcessHeap(), 0, devices, sizeof(devices[0])*(nrdevices+1));
 		else
-			devices = malloc(sizeof(devices[0]));
-		devices[nrdevices].modname = strdup(dsname);
+			devices = HeapAlloc(GetProcessHeap(), 0, sizeof(devices[0]));
+		if ((devices[nrdevices].modname = HeapAlloc(GetProcessHeap(), 0, strlen(dsname) + 1)))
+			lstrcpyA(devices[nrdevices].modname, dsname);
 		devices[nrdevices].identity = sourceId;
 		nrdevices++;
 		DSM_sourceId++;




More information about the wine-cvs mailing list