null+****@clear*****
null+****@clear*****
2012年 4月 16日 (月) 23:47:13 JST
Kouhei Sutou 2012-04-16 23:47:13 +0900 (Mon, 16 Apr 2012) New Revision: b2a643e87b643417daec960efb74cebe4513d5d9 Log: wrapper: use memcpy() instead of '=' for delegating dup_ref value We should copy values insated of share them because "share" may cause double free. refs #1301 Modified files: ha_mroonga.cpp Modified: ha_mroonga.cpp (+1 -3) =================================================================== --- ha_mroonga.cpp 2012-04-16 23:23:35 +0900 (84d35e9) +++ ha_mroonga.cpp 2012-04-16 23:47:13 +0900 (8542d85) @@ -3762,9 +3762,6 @@ 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); @@ -3772,6 +3769,7 @@ int ha_mroonga::wrapper_info(uint flag) 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;