Hi Eric,

On Tue, Sep 22, 2009 at 1:15 PM, Eric Day <[email protected]> wrote:
>You
> many not always need to drizzle_result_free() it depending on the
> return code

Knowing this makes a big difference :)
I think that this fix
http://bazaar.launchpad.net/~diego-fmpwizard/drizzle/bug-fixes/revision/1133#client/drizzle.cc
is fine then, because when we don;t have an active connection to drizzled,
ret will be ==
DRIZZLE_RETURN_COULD_NOT_CONNECT
after  running  "drizzle_query_str"


Thanks Eric,


   -Diego


>I'll need to
> take a closer look under the debugger.
>
> -Eric
>
> On Tue, Sep 22, 2009 at 11:51:36AM -0400, Diego Medina wrote:
>> Hi,
>>
>> Looking for a better fix for bug# 432210
>> https://bugs.launchpad.net/drizzle/+bug/432210
>>
>> I turned to valgrind for some answers. This is what it told me:
>>
>> ==28701== Use of uninitialised value of size 8
>> ==28701==    at 0x4C23A10: drizzle_column_free (column.c:357)
>> ==28701==    by 0x4C228EC: drizzle_result_free (result.c:81)
>> ==28701==    by 0x408C11: get_current_db() (drizzle.cc:2607)
>> ==28701==    by 0x40BC75: com_use(std::string*, char const*) 
>> (drizzle.cc:3762)
>> ==28701==    by 0x4078BF: add_line(std::string*, char*, char*, bool*)
>> (drizzle.cc:2152)
>> ==28701==    by 0x406D29: read_and_execute(bool) (drizzle.cc:1915)
>> ==28701==    by 0x405D4D: main (drizzle.cc:1324)
>> ==28701==  Uninitialised value was created by a stack allocation
>> ==28701==    at 0x408B59: get_current_db() (drizzle.cc:2591)
>>
>>
>> .........
>> ==28701==    at 0x408B59: get_current_db() (drizzle.cc:2591)
>> ........
>>
>> line 2591 is :
>>
>> 2590 static void get_current_db(void)
>> 2591 {
>> 2592  drizzle_return_t ret;
>> 2593  drizzle_result_st res;
>>
>>   free(current_db);
>>   current_db= NULL;
>>   /* In case of error below current_db will be NULL */
>>   if (drizzle_query_str(&con, &res, "SELECT DATABASE()", &ret) != NULL)
>>   {
>>     if (ret == DRIZZLE_RETURN_OK &&
>>         drizzle_result_buffer(&res) == DRIZZLE_RETURN_OK)
>>     {
>>       drizzle_row_t row= drizzle_row_next(&res);
>>       if (row[0])
>>         current_db= strdup(row[0]);
>>     }
>>     drizzle_result_free(&res);
>>   }
>> }
>>
>>
>> This is what I want to do, but 1) I don't know how, and 2) I'm not
>> even sure this is the way to fix it.
>>
>> * How do I initialize  drizzle_result_st  res ?
>> because drizzle_result_st  res= NULL; does not work :)
>>
>>
>> Thanks
>>
>> Diego
>>
>>
>>
>>
>>
>> --
>> 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
>



-- 
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