From: jongfoster Date: Fri, 1 Jun 2001 20:03:42 +0000 (+0000) Subject: Better memory management - current_action->strings[] now X-Git-Tag: v_2_9_9~422 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=e1a30489c51887b11a12847aaa74b527be6a926c Better memory management - current_action->strings[] now contains copies of the strings, not the original. --- 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]);