Francois Gouget : gphoto2.ds: Use Win32 APIs instead of strdup().

Alexandre Julliard julliard at winehq.org
Mon May 18 08:13:13 CDT 2009


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Sun May 17 13:30:10 2009 +0200

gphoto2.ds: Use Win32 APIs instead of strdup().

---

 dlls/gphoto2.ds/gphoto2_main.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/gphoto2.ds/gphoto2_main.c b/dlls/gphoto2.ds/gphoto2_main.c
index bb2c31c..ab4f392 100644
--- a/dlls/gphoto2.ds/gphoto2_main.c
+++ b/dlls/gphoto2.ds/gphoto2_main.c
@@ -37,6 +37,13 @@
 WINE_DEFAULT_DEBUG_CHANNEL(twain);
 
 
+static char* GPHOTO2_StrDup(const char* str)
+{
+    char* dst = HeapAlloc(GetProcessHeap(), 0, strlen(str)+1);
+    strcpy(dst, str);
+    return dst;
+}
+
 static void
 load_filesystem(const char *folder) {
 #ifdef HAVE_GPHOTO2
@@ -63,12 +70,12 @@ load_filesystem(const char *folder) {
 	ret = gp_list_get_name (list, i, &name);
 	if (ret < GP_OK)
 	    continue;
-	gpfile = HeapAlloc(GetProcessHeap(), 0, sizeof(struct gphoto2_file));
+	gpfile = HeapAlloc(GetProcessHeap(), 0, sizeof(struct gphoto2_file)); /* FIXME: Leaked */
 	if (!gpfile)
 	    continue;
 	TRACE("adding %s/%s\n", folder, name);
-	gpfile->folder = strdup(folder);
-	gpfile->filename = strdup(name);
+	gpfile->folder = GPHOTO2_StrDup(folder);
+	gpfile->filename = GPHOTO2_StrDup(name);
 	gpfile->download = FALSE;
 	list_add_tail( &activeDS.files, &gpfile->entry );
     }




More information about the wine-cvs mailing list