match &= cb_default(EXTERNAL_OBJ(cur->astobj), arg, flags);
}
+ /* we found the object, performing operations according flags */
if (match == 0) { /* no match, no stop, continue */
continue;
} else if (match == CMP_STOP) { /* no match but stop, we are done */
break;
}
- /* we found the object, performing operations according flags */
/* we have a match (CMP_MATCH) here */
if (!(flags & OBJ_NODATA)) { /* if must return the object, record the value */
/* it is important to handle this case before the unlink */
AST_LIST_REMOVE_CURRENT(entry);
/* update number of elements */
ast_atomic_fetchadd_int(&c->elements, -1);
+ /* if the object is not going to be returned, we must decrement the reference count
+ * to account for the reference the container was holding
+ */
+ if (flags & OBJ_NODATA) {
+ if (tag)
+ __ao2_ref_debug(EXTERNAL_OBJ(cur->astobj), -1, tag, file, line, funcname);
+ else
+ __ao2_ref(EXTERNAL_OBJ(cur->astobj), -1);
+ }
ast_free(cur); /* free the link record */
}