Segmentation Fault in aerospike_key_get()

You are passing in a pointer to a uninitialized record. The client code assumes you have already initialized the record and tries to reuse the structure. This will result in corruption.

There are two ways to fix.

  1. Pass in a pointer to a NULL record pointer. The client will allocate the record for you in this case:
as_record* p_rec = NULL;
aerospike_key_get(&RtDbConnection::ms_aerospikeIns, &l_asError, NULL, &l_key, &p_rec)
  1. Pass in a pointer to an initialized record.
as_record rec;
as_record_init(&rec, nbins);  // Use as_record_inita() to place rec bins on stack.
as_record* p_rec = &rec;
aerospike_key_get(&RtDbConnection::ms_aerospikeIns, &l_asError, NULL, &l_key, &p_rec)
2 Likes