Re: [PATCH] expand mutt vars as we do environment vars
On 2006-01-12 at 13:55 +0100, Phil Pennock wrote:
> Infinite loop bug if you attempt to delete an unset variable.
First patch bogus because it's not meant to be a circular list and that
still left another bug, where querying a value after removing the only
set variable would result in a segfault because MyVars was now pointing
to stale memory.
As an alternative fix:
--- mutt/init.c 2006-01-12 18:24:01.000000000 +0100
+++ mutt-betterfix/init.c 2006-01-12 18:26:59.000000000 +0100
@@ -3054,7 +3054,10 @@ static void myvar_del (const char* var)
{
if (!mutt_strcmp (cur->name, var))
{
- prev->next = cur->next;
+ if (cur == MyVars)
+ MyVars = cur->next;
+ else
+ prev->next = cur->next;
FREE (&cur->name);
FREE (&cur->value);
FREE (&cur);