[asterisk-commits] res sorcery memory cache.c: Fix off nominal ref leak. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 3 05:51:17 CST 2015


Joshua Colp has submitted this change and it was merged.

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(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c
index 0ce0e33..58aaada 100644
--- a/res/res_sorcery_memory_cache.c
+++ b/res/res_sorcery_memory_cache.c
@@ -848,13 +848,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/1744
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If83d63cf11cbc6df9b15251848b01feb570ade49
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list