diff --git a/daemon/redis.c b/daemon/redis.c index 20837c337..197a1c430 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -2157,14 +2157,13 @@ void redis_update_onekey(struct call *c, struct redis *r) { return; err: - - mutex_unlock(&r->lock); - rwlock_unlock_r(&c->master_lock); if (r->ctx && r->ctx->err) rlog(LOG_ERR, "Redis error: %s", r->ctx->errstr); redisFree(r->ctx); r->ctx = NULL; + mutex_unlock(&r->lock); + rwlock_unlock_r(&c->master_lock); } /* must be called lock-free */ @@ -2190,13 +2189,13 @@ void redis_delete(struct call *c, struct redis *r) { return; err: - rwlock_unlock_r(&c->master_lock); - mutex_unlock(&r->lock); - if (r->ctx && r->ctx->err) rlog(LOG_ERR, "Redis error: %s", r->ctx->errstr); redisFree(r->ctx); r->ctx = NULL; + + rwlock_unlock_r(&c->master_lock); + mutex_unlock(&r->lock); }