Skip to content

Commit

Permalink
Merge pull request aerospike#143 from citrusleaf/CLIENT-691
Browse files Browse the repository at this point in the history
Fixed seg fault on double connect()
  • Loading branch information
Jeff Boone committed Apr 4, 2016
2 parents ee8ef74 + 1262bfe commit d049753
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main/client/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,22 @@ PyObject * AerospikeClient_Connect(AerospikeClient * self, PyObject * args, PyOb
}

if (self->as->config.hosts_size) {

alias_to_search = return_search_string(self->as);

PyObject * py_persistent_item = PyDict_GetItemString(py_global_hosts, alias_to_search);
if (py_persistent_item) {
aerospike *as = ((AerospikeGlobalHosts*)py_persistent_item)->as;
//Destroy the initial aeorpsike object as it has to point to the one in
//Destroy the initial aerospike object as it has to point to the one in
//the persistent list now
aerospike_destroy(self->as);
self->as = as;
self->as->config.shm_key = ((AerospikeGlobalHosts*)py_persistent_item)->shm_key;
if (as != self->as) {
aerospike_destroy(self->as);
self->as = as;
self->as->config.shm_key = ((AerospikeGlobalHosts*)py_persistent_item)->shm_key;

//Increase ref count of object containing same *as object
((AerospikeGlobalHosts*)py_persistent_item)->ref_cnt++;
//Increase ref count of object containing same *as object
((AerospikeGlobalHosts*)py_persistent_item)->ref_cnt++;
}
goto CLEANUP;
// xxx Code never reached. Is it needed?
//PyMem_Free(alias_to_search);
//alias_to_search = NULL;
}
//Generate unique shm_key
PyObject *py_key, *py_value;
Expand Down

0 comments on commit d049753

Please sign in to comment.