]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_sorcery_realtime.c: Fix crash from NULL sorcery object type. 00/1700/1
authorRichard Mudgett <rmudgett@digium.com>
Mon, 23 Nov 2015 20:27:27 +0000 (14:27 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 23 Nov 2015 20:46:57 +0000 (14:46 -0600)
If the sorcery object type is not found a NULL is returned.
Unfortunately, sorcery_realtime_filter_objectset() will crash after
complaining about not finding the object type and saying to expect errors.

* Use ao2_cleanup() instead of ao2_ref() to prevent the crash.

ASTERISK-25165
Reported by Corey Farrell

Change-Id: Ic3b64453ea3058cb68d5c26d97d4fe7b8eea2e97

res/res_sorcery_realtime.c

index b2df2981491c19309d5b22c428b4f8481cbc46f8..8807c01961ae0d04c381c7892f246b4efbebdc6c 100644 (file)
@@ -142,7 +142,7 @@ static struct ast_variable *sorcery_realtime_filter_objectset(struct ast_variabl
                }
        }
 
-       ao2_ref(object_type, -1);
+       ao2_cleanup(object_type);
 
        return objectset;
 }