From aa895640ed6142837754cc1b5e4111bcdcec0105 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 15 Sep 2009 06:03:23 +0000 Subject: [PATCH] Don't mutate input to SPLIT_BY_CHARACTERS. [SVN r56204] --- historic/jam/src/builtins.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/historic/jam/src/builtins.c b/historic/jam/src/builtins.c index 9889bb15e..cbe42fea6 100644 --- a/historic/jam/src/builtins.c +++ b/historic/jam/src/builtins.c @@ -858,7 +858,7 @@ LIST * builtin_split_by_characters( PARSE * parse, FRAME * frame ) LIST * result = 0; - char* s = l1->string; + char* s = strdup (l1->string); char* delimiters = l2->string; char* t; @@ -869,6 +869,8 @@ LIST * builtin_split_by_characters( PARSE * parse, FRAME * frame ) t = strtok (NULL, delimiters); } + free (s); + return result; }