From bde7bbf9ad62c24bcf5c8ca7fc0423db69e01699 Mon Sep 17 00:00:00 2001 From: harti Date: Wed, 8 Dec 2004 08:11:59 +0000 Subject: 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 --- usr.bin/make/dir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin/make/dir.c') 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); } -- cgit v1.1