On 05/23/2011 02:38 PM, Dmitry Lenev wrote:
> Hello Luis!
> * Luis Soares<luis.soares@stripped> [11/05/23 13:21]:
>> #At file:///home/lsoares/Workspace/bzr/work/bugfixing/12558519/mysql-5.5/ based
> on revid:marc.alff@stripped
>> 3386 Luis Soares 2011-05-23
>> BUG#12558519: RPL_TYPECONV PRODUCES VALGRIND STACK
>> In RBR and in case of converting blob fields, the space allocated
>> while unpacking into the conversion field was not freed after
>> copying from it into the real field.
>> We fix this by freeing the conversion field when the conversion
>> table is not needed anymore (on close_tables_to_lock).
>> === modified file 'sql/table.cc'
>> --- a/sql/table.cc 2011-03-25 14:03:44 +0000
>> +++ b/sql/table.cc 2011-05-23 09:17:17 +0000
>> @@ -2188,7 +2188,8 @@ void free_blobs(register TABLE *table)
>> for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields
>> ptr != end ;
>> - ((Field_blob*) table->field[*ptr])->free();
>> + if (table->field[*ptr])
>> + ((Field_blob*) table->field[*ptr])->free();
> I think it is better to add small comment here that will explain
> why do we have to check if table->field[*ptr] is not NULL.
> Something like:
> Reduced TABLE objects which are used by row-based replication for
> type conversion might have some fields missing. Skip freeing BLOB
> buffers for such missing fields.
Thanks, that's a nice comment. Added:
> Otherwise I am OK with your patch and think that it can be pushed
> after considering the above suggestion and getting approval from an
> expert from Replication team.
Alfranio reviewed and approved it.
Thanks for taking time to look into this.