From e1a30489c51887b11a12847aaa74b527be6a926c Mon Sep 17 00:00:00 2001 From: jongfoster Date: Fri, 1 Jun 2001 20:03:42 +0000 Subject: [PATCH 1/1] Better memory management - current_action->strings[] now contains copies of the strings, not the original. --- actions.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/actions.c b/actions.c index 3fe17cb2..9069e415 100644 --- a/actions.c +++ b/actions.c @@ -1,4 +1,4 @@ -const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster Exp $"; +const char actions_rcs[] = "$Id: actions.c,v 1.3 2001/06/01 18:49:17 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/actions.c,v $ @@ -33,6 +33,10 @@ const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster * * Revisions : * $Log: actions.c,v $ + * Revision 1.3 2001/06/01 18:49:17 jongfoster + * Replaced "list_share" with "list" - the tiny memory gain was not + * worth the extra complexity. + * * Revision 1.2 2001/05/31 21:40:00 jongfoster * Removing some commented out, obsolete blocks of code. * @@ -737,7 +741,8 @@ void merge_current_action (struct current_action_spec *dest, char * str = src->string[i]; if (str) { - dest->string[i] = str; + freez(dest->string[i]); + dest->string[i] = strdup(str); } } @@ -774,6 +779,11 @@ void free_current_action (struct current_action_spec *src) { int i; + for (i = 0; i < ACTION_STRING_COUNT; i++) + { + freez(src->string[i]); + } + for (i = 0; i < ACTION_MULTI_COUNT; i++) { destroy_list(src->multi[i]); -- 2.39.2