Skip to content

Commit fe1eb51

Browse files
spetruniainikep
authored andcommitted
Fix issue #10: Segfault in RDBSE_KEYDEF::get_primary_key_tuple
1 parent c4b9587 commit fe1eb51

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

storage/rocksdb/rdb_datadic.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ void RDBSE_KEYDEF::setup(TABLE *tbl)
7474
if (keyno != tbl->s->primary_key)
7575
{
7676
n_pk_key_parts= pk_info->actual_key_parts;
77-
pk_part_no= (uint*)my_malloc(sizeof(uint)*n_pk_key_parts, MYF(0));
7877
}
7978
else
8079
{
8180
pk_info= NULL;
82-
pk_part_no= NULL;
81+
n_pk_key_parts= 0;
8382
}
8483

8584
// "unique" secondary keys support:
@@ -93,6 +92,11 @@ void RDBSE_KEYDEF::setup(TABLE *tbl)
9392
unique_secondary_index= true;
9493
}
9594

95+
if (keyno != tbl->s->primary_key)
96+
pk_part_no= (uint*)my_malloc(sizeof(uint)*m_key_parts, MYF(0));
97+
else
98+
pk_part_no= NULL;
99+
96100
size_t size= sizeof(Field_pack_info) * m_key_parts;
97101
pack_info= (Field_pack_info*)my_malloc(size, MYF(0));
98102

0 commit comments

Comments
 (0)