add missing lock for failed call restores

Change-Id: Ibeff1501483038c528f9ba92fe461ec866e73bff
pull/334/head
Richard Fuchs 9 years ago
parent d8cc8caf9c
commit d513c6dd2b

@ -1396,21 +1396,18 @@ static void json_restore_call(struct redis *r, struct callmaster *m, const str *
JsonParser *parser =0;
rr_jsonStr = redis_get(r, REDIS_REPLY_STRING, "GET " PB, STR(callid));
if (!rr_jsonStr) {
rlog(LOG_ERR, "Could not retrieve json data from redis for key: "STR_FORMAT, STR_FMT(callid));
err = "could not retrieve JSON data from redis";
if (!rr_jsonStr)
goto err1;
}
parser = json_parser_new();
if (!json_parser_load_from_data (parser, rr_jsonStr->str, -1, NULL)) {
rlog(LOG_DEBUG, "Could not parse json data !");
err = "could not parse JSON data";
if (!json_parser_load_from_data (parser, rr_jsonStr->str, -1, NULL))
goto err1;
}
root_reader = json_reader_new (json_parser_get_root (parser));
if (!root_reader) {
rlog(LOG_DEBUG, "Could not read json data !");
err = "could not read JSON data";
if (!root_reader)
goto err1;
}
c = call_get_or_create(callid, m, type);
err = "failed to create call struct";
@ -1532,8 +1529,11 @@ err1:
err);
if (c)
call_destroy(c);
else
else {
mutex_lock(&m->conf.redis_write->lock);
redisCommandNR(m->conf.redis_write->ctx, "DEL " PB, STR(callid));
mutex_unlock(&m->conf.redis_write->lock);
}
}
if (c)
obj_put(c);

Loading…
Cancel
Save