Navigation Menu

Skip to content

Commit

Permalink
wrapper: use memcpy() instead of '=' for delegating dup_ref value
Browse files Browse the repository at this point in the history
We should copy values insated of share them because "share" may cause
double free.

refs #1301
  • Loading branch information
kou committed Apr 16, 2012
1 parent b717971 commit b2a643e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ha_mroonga.cpp
Expand Up @@ -3762,16 +3762,14 @@ int ha_mroonga::wrapper_info(uint flag)
{
int error = 0;
MRN_DBUG_ENTER_METHOD();
if (flag & HA_STATUS_ERRKEY) {
wrap_handler->dup_ref = dup_ref;
}
MRN_SET_WRAP_SHARE_KEY(share, table->s);
MRN_SET_WRAP_TABLE_KEY(this, table);
error = wrap_handler->info(flag);
MRN_SET_BASE_SHARE_KEY(share, table->s);
MRN_SET_BASE_TABLE_KEY(this, table);
if (flag & HA_STATUS_ERRKEY) {
errkey = wrap_handler->errkey;
memcpy(dup_ref, wrap_handler->dup_ref, wrap_handler->ref_length);
}
if (flag & HA_STATUS_TIME) {
stats.update_time = wrap_handler->stats.update_time;
Expand Down

0 comments on commit b2a643e

Please sign in to comment.