From f7679b4594afc38c380a7ed3bd8721f06b87214e Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Fri, 7 Apr 2006 14:20:49 +0900 Subject: [PATCH] libwine: Fix a memory leak. --- libs/wine/config.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/wine/config.c b/libs/wine/config.c index 5aadf73ff22..a130021a02c 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c @@ -117,7 +117,7 @@ static char *build_path( const char *dir, const char *name ) } /* 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( const char *basedir, const char *bindir ) 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 *argv0 ) 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; }