[Asterisk-code-review] res sorcery memory cache.c: Fix off nominal ref leak. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Tue Dec 1 11:54:45 CST 2015


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/1748

Change subject: res_sorcery_memory_cache.c: Fix off nominal ref leak.
......................................................................

res_sorcery_memory_cache.c: Fix off nominal ref leak.

Change-Id: If83d63cf11cbc6df9b15251848b01feb570ade49
---
M res/res_sorcery_memory_cache.c
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/1748/1

diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c
index bfa90e8..0d7630e 100644
--- a/res/res_sorcery_memory_cache.c
+++ b/res/res_sorcery_memory_cache.c
@@ -850,13 +850,16 @@
 			if (cached->stale_update_sched_id == -1) {
 				struct stale_update_task_data *task_data;
 
-				task_data = stale_update_task_data_alloc((struct ast_sorcery *)sorcery, cache,
-					type, cached->object);
+				task_data = stale_update_task_data_alloc((struct ast_sorcery *) sorcery,
+					cache, type, cached->object);
 				if (task_data) {
 					ast_debug(1, "Cached sorcery object type '%s' ID '%s' is stale. Refreshing\n",
 						type, id);
-					cached->stale_update_sched_id = ast_sched_add(sched, 1, stale_item_update, task_data);
-				} else {
+					cached->stale_update_sched_id = ast_sched_add(sched, 1,
+						stale_item_update, task_data);
+				}
+				if (cached->stale_update_sched_id < 0) {
+					ao2_cleanup(task_data);
 					ast_log(LOG_ERROR, "Unable to update stale cached object type '%s', ID '%s'.\n",
 						type, id);
 				}

-- 
To view, visit https://gerrit.asterisk.org/1748
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If83d63cf11cbc6df9b15251848b01feb570ade49
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list