Always quit and free memcached result in gets

This commit is contained in:
lericson 2010-10-09 00:53:37 +02:00
parent 9d4b01ff4d
commit 8186f9f009

View File

@ -448,6 +448,12 @@ static PyObject *PylibMC_Client_gets(PylibMC_Client *self, PyObject *arg) {
ret = _PylibMC_parse_memcached_value((char *)mc_val, val_size, flags);
ret = Py_BuildValue("(NL)", ret, cas);
} else if (rc == MEMCACHED_END) {
/* Key not found => (None, None) */
return Py_BuildValue("(OO)", Py_None, Py_None);
} else {
return PylibMC_ErrFromMemcached(self, "memcached_gets", rc);
}
/* reset cursor if mget for some reason returned more than one result.
this should be a no-op otherwise. */
@ -458,12 +464,6 @@ static PyObject *PylibMC_Client_gets(PylibMC_Client *self, PyObject *arg) {
memcached_result_free(&results_obj);
return ret;
} else if (rc == MEMCACHED_END) {
/* Key not found => (None, None) */
return Py_BuildValue("(OO)", Py_None, Py_None);
} else {
return PylibMC_ErrFromMemcached(self, "memcached_gets", rc);
}
}
/* {{{ Set commands (set, replace, add, prepend, append) */