summaryrefslogtreecommitdiff
path: root/lib/progreloc.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-01-08 00:28:30 +0100
committerBruno Haible <bruno@clisp.org>2008-01-08 00:28:30 +0100
commit1146b210ba48607a5a29ea516a5cda3d5afa6542 (patch)
tree88b292cf84253aca0de3a2a3d1ab46624ec8d631 /lib/progreloc.c
parentaa9089a1a26a2f012bb4392b9ee91e5e12667ab3 (diff)
downloadgnulib-1146b210ba48607a5a29ea516a5cda3d5afa6542.tar.gz
Improve memory cleanup in 'relocatable' module.
Diffstat (limited to 'lib/progreloc.c')
-rw-r--r--lib/progreloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/progreloc.c b/lib/progreloc.c
index ac9433bf6b..0eaad38559 100644
--- a/lib/progreloc.c
+++ b/lib/progreloc.c
@@ -1,5 +1,5 @@
/* Provide relocatable programs.
- Copyright (C) 2003-2007 Free Software Foundation, Inc.
+ Copyright (C) 2003-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or modify
@@ -281,7 +281,7 @@ static void
prepare_relocate (const char *orig_installprefix, const char *orig_installdir,
const char *argv0)
{
- const char *curr_prefix;
+ char *curr_prefix;
/* Determine the full pathname of the current executable. */
executable_fullname = find_executable (argv0);
@@ -290,8 +290,12 @@ prepare_relocate (const char *orig_installprefix, const char *orig_installdir,
curr_prefix = compute_curr_prefix (orig_installprefix, orig_installdir,
executable_fullname);
if (curr_prefix != NULL)
- /* Now pass this prefix to all copies of the relocate.c source file. */
- set_relocation_prefix (orig_installprefix, curr_prefix);
+ {
+ /* Now pass this prefix to all copies of the relocate.c source file. */
+ set_relocation_prefix (orig_installprefix, curr_prefix);
+
+ free (curr_prefix);
+ }
}
/* Set program_name, based on argv[0], and original installation prefix and