On Tue, Sep 22, 2009 at 8:27 AM, Diego Medina <[email protected]> wrote:
> I think I found where to add the proper clean

Never mind, this introduces another crash on the client.


>
>
> === modified file 'client/drizzle.cc'
> --- client/drizzle.cc   2009-09-22 02:52:12 +0000
> +++ client/drizzle.cc   2009-09-22 12:24:00 +0000
> @@ -2603,8 +2603,8 @@
>       drizzle_row_t row= drizzle_row_next(&res);
>       if (row[0])
>         current_db= strdup(row[0]);
> -      drizzle_result_free(&res);
>     }
> +    drizzle_result_free(&res);
>   }
>  }
>
> @@ -3805,7 +3805,11 @@
>         }
>
>         if (ret != DRIZZLE_RETURN_SERVER_GONE || !try_again)
> -          return put_error(&con, NULL);
> +        {
> +          int error= put_error(&con, NULL);
> +          drizzle_con_free(&con);
> +          return error;
> +        }
>
>         if (reconnect())
>
>
>
>
>   -Diego
>
>
> On Tue, Sep 22, 2009 at 6:27 AM, Diego Medina <[email protected]> wrote:
>> Thanks for the explanation Padraig, Eric,
>>
>> Eric:
>>
>> On Tue, Sep 22, 2009 at 1:12 AM, Eric Day <[email protected]> wrote:
>>> If
>>> you're hitting a bug where there is an invalid address in one of the
>>> pointers, something was not properly cleaned up previously.
>>
>> This is the bug that I was referring to:
>> https://bugs.launchpad.net/drizzle/+bug/432210
>>
>> While I managed to fix them, I don't really like the solution I came
>> up with for the second crash (only call
>> drizzle_result_free(&res); if we got a DRIZZLE_RETURN_OK
>>
>> I tried to find where all pointer in res were supposed to be freed,
>> but I couldn't :(
>>
>> Thanks
>>
>> Diego
>>
>>
>>>
>>> -Eric
>>>
>>> On Mon, Sep 21, 2009 at 10:19:58PM -0400, Padraig O'Sullivan wrote:
>>>> On Mon, Sep 21, 2009 at 9:53 PM, Diego Medina <[email protected]> wrote:
>>>> > Hi,
>>>> >
>>>> > In libdrizzle/column.c:355 we have:
>>>> >
>>>> > void drizzle_column_free(drizzle_column_st *column)
>>>> > {
>>>> >  if (column->result->column_list == column)
>>>> >    column->result->column_list= column->next;
>>>> >  if (column->prev)
>>>> >    column->prev->next= column->next;
>>>> >  if (column->next)
>>>> >    column->next->prev= column->prev;
>>>> >
>>>> >  if (column->options & DRIZZLE_COLUMN_ALLOCATED)
>>>> >    free(column);
>>>> > }
>>>> >
>>>> > why can't is just be
>>>> >
>>>> >  if (column->options & DRIZZLE_COLUMN_ALLOCATED)
>>>> >    free(column);
>>>>
>>>> From not knowing the above code, it looks to me like it is removing
>>>> column from a doubly-linked list before freeing the memory allocated
>>>> for column. This statement:
>>>>
>>>> if (column->result->column_list == column)
>>>>   column->result->column_list= column->next;
>>>>
>>>> looks like it modifies the head of the linked list i.e. if the node to
>>>> be deleted is the head, modify the head to point to the next in the
>>>> list.
>>>>
>>>> These statements:
>>>>
>>>> if (column->prev)
>>>>   column->prev->next= column->next;
>>>> if (column->next)
>>>>   column->next->prev= column->prev;
>>>>
>>>> just splice the node to be deleted out of the linked list by modifying
>>>> the successor and predecessor pointers of column's successor and
>>>> predecessor.
>>>>
>>>> So yeah, I would assume this code is needed.
>>>>
>>>> -Padraig
>>>>
>>>> >
>>>> > ?
>>>> >
>>>> > Thanks
>>>> >
>>>> >   -Diego
>>>> >
>>>> > P.S. oh, why do I ask, there are times when
>>>> > column->result->column_list  points to an address that cannot be
>>>> > accessed (like in this bug
>>>> > https://bugs.launchpad.net/drizzle/+bug/432210 )
>>>> > I fixed that one bug, but now I see a new one because
>>>> > column->prev->next is in an address that cannot be accessed :|
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > Diego Medina
>>>> > Web Developer
>>>> > http://www.fmpwizard.com
>>>> >
>>>> > _______________________________________________
>>>> > Mailing list: https://launchpad.net/~drizzle-discuss
>>>> > Post to     : [email protected]
>>>> > Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>> > More help   : https://help.launchpad.net/ListHelp
>>>> >
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>>> Post to     : [email protected]
>>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>>
>> --
>> Diego Medina
>> Web Developer
>> http://www.fmpwizard.com
>>
>
>
>
> --
> Diego Medina
> Web Developer
> http://www.fmpwizard.com
>



-- 
Diego Medina
Web Developer
http://www.fmpwizard.com

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to