mirror of https://mirror.osredm.com/root/redis.git
VADD: fix leak on thread creation failure.
This commit is contained in:
parent
3e2649f1f1
commit
a6c8a15cad
7
vset.c
7
vset.c
|
@ -617,6 +617,8 @@ int VADD_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
|
||||||
pthread_rwlock_unlock(&vset->in_use_lock);
|
pthread_rwlock_unlock(&vset->in_use_lock);
|
||||||
RedisModule_AbortBlock(bc);
|
RedisModule_AbortBlock(bc);
|
||||||
RedisModule_Free(targ);
|
RedisModule_Free(targ);
|
||||||
|
RedisModule_FreeString(ctx,val);
|
||||||
|
if (attrib) RedisModule_FreeString(ctx,attrib);
|
||||||
|
|
||||||
// Fall back to synchronous insert, see later in the code.
|
// Fall back to synchronous insert, see later in the code.
|
||||||
} else {
|
} else {
|
||||||
|
@ -1561,7 +1563,8 @@ void *VectorSetRdbLoad(RedisModuleIO *rdb, int encver) {
|
||||||
uint32_t hnsw_m = (hnsw_config >> 8) & 0xffff;
|
uint32_t hnsw_m = (hnsw_config >> 8) & 0xffff;
|
||||||
|
|
||||||
if (hnsw_m == 0) hnsw_m = 16; // Default, useful for RDB files predating
|
if (hnsw_m == 0) hnsw_m = 16; // Default, useful for RDB files predating
|
||||||
// this configuration parameter.
|
// this configuration parameter: it was fixed
|
||||||
|
// to 16.
|
||||||
struct vsetObject *vset = createVectorSetObject(dim,quant_type,hnsw_m);
|
struct vsetObject *vset = createVectorSetObject(dim,quant_type,hnsw_m);
|
||||||
RedisModule_Assert(vset != NULL);
|
RedisModule_Assert(vset != NULL);
|
||||||
|
|
||||||
|
@ -1622,7 +1625,7 @@ void *VectorSetRdbLoad(RedisModuleIO *rdb, int encver) {
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
RedisModule_LogIOError(rdb,"warning",
|
RedisModule_LogIOError(rdb,"warning",
|
||||||
"Vector set node index loading error");
|
"Vector set node index loading error");
|
||||||
return NULL; // Loading error.
|
return NULL; // Loading error: abort, no need to free resources.
|
||||||
}
|
}
|
||||||
if (nv->attrib) vset->numattribs++;
|
if (nv->attrib) vset->numattribs++;
|
||||||
RedisModule_DictSet(vset->dict,ele,node);
|
RedisModule_DictSet(vset->dict,ele,node);
|
||||||
|
|
Loading…
Reference in New Issue