summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/dir.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-08 08:11:59 +0000
committerharti <harti@FreeBSD.org>2004-12-08 08:11:59 +0000
commitbde7bbf9ad62c24bcf5c8ca7fc0423db69e01699 (patch)
treea7ee9927fa2e9d0ed7221a08d2ef7ecdf58e3840 /usr.bin/make/dir.c
parent979de51e35ba33e737fc2b53a531376af247283d (diff)
downloadFreeBSD-src-bde7bbf9ad62c24bcf5c8ca7fc0423db69e01699.zip
FreeBSD-src-bde7bbf9ad62c24bcf5c8ca7fc0423db69e01699.tar.gz
Consify the arguments to str_concat. Remove the STR_DOFREE flag for that
purpose and explicitely free the input string in the one place that was calling str_concat with that flag. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make/dir.c')
-rw-r--r--usr.bin/make/dir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index b9cfbdf..861da59 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1115,6 +1115,7 @@ Dir_MakeFlags(char *flag, Lst *path)
{
char *str; /* the string which will be returned */
char *tstr; /* the current directory preceded by 'flag' */
+ char *nstr;
LstNode *ln; /* the node of the current directory */
Path *p; /* the structure describing the current directory */
@@ -1124,7 +1125,10 @@ Dir_MakeFlags(char *flag, Lst *path)
while ((ln = Lst_Next(path)) != NULL) {
p = Lst_Datum(ln);
tstr = str_concat(flag, p->name, 0);
- str = str_concat(str, tstr, STR_ADDSPACE | STR_DOFREE);
+ nstr = str_concat(str, tstr, STR_ADDSPACE);
+ free(str);
+ free(tstr);
+ str = nstr;
}
Lst_Close(path);
}
OpenPOWER on IntegriCloud