Mike McCormack : libwine: Fix a memory leak.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 7 05:04:37 CDT 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Fri Apr  7 14:20:49 2006 +0900

libwine: Fix a memory leak.

---

 libs/wine/config.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libs/wine/config.c b/libs/wine/config.c
index 5aadf73..a130021 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -117,7 +117,7 @@ static char *build_path( const char *dir
 }
 
 /* return the directory that contains the library at run-time */
-static const char *get_runtime_libdir(void)
+static char *get_runtime_libdir(void)
 {
 #ifdef HAVE_DLADDR
     Dl_info info;
@@ -279,8 +279,8 @@ static char *running_from_build_dir( con
 void wine_init_argv0_path( const char *argv0 )
 {
     size_t size, len;
-    const char *p, *libdir, *basename;
-    char *cwd;
+    const char *p, *basename;
+    char *cwd, *libdir;
 
     if (!(p = strrchr( argv0, '/' )))
         basename = argv0;
@@ -292,10 +292,14 @@ void wine_init_argv0_path( const char *a
     if ((libdir = get_runtime_libdir()))
     {
         bindir = build_path( libdir, LIB_TO_BINDIR );
-        if ((build_dir = running_from_build_dir( libdir, bindir ))) goto in_build_dir;
-
+        if ((build_dir = running_from_build_dir( libdir, bindir )))
+        {
+            free( libdir );
+            goto in_build_dir;
+        }
         dlldir = build_path( libdir, LIB_TO_DLLDIR );
         datadir = build_path( libdir, LIB_TO_DATADIR );
+        free( libdir );
         return;
     }
 




More information about the wine-cvs mailing list