/*!
 * \brief Free an \ref optional_api.
 *
 * \param api API struct to free.
 */
static void optional_api_destroy(struct optional_api *api)
{
	while (api->users_len--) {
		optional_api_user_destroy(api->users[api->users_len]);
	}
	ast_std_free(api->users);
	api->users = NULL;
	api->users_maxlen = 0;
	ast_std_free(api);
}
Example #2
0
void *__ast_bt_destroy(struct ast_bt *bt)
{
    if (bt && bt->alloced) {
        ast_std_free(bt);
    }
    return NULL;
}
Example #3
0
static inline void delete_reentrancy_cs(struct ast_lock_track **plt)
{
	struct ast_lock_track *lt;

	if (*plt) {
		lt = *plt;
		*plt = NULL;

		pthread_mutex_destroy(&lt->reentr_mutex);
		ast_std_free(lt);
	}
}
Example #4
0
static void __dump_backtrace(struct ast_bt *bt, int canlog)
{
	char **strings;
	ssize_t i;

	strings = backtrace_symbols(bt->addresses, bt->num_frames);

	for (i = 0; i < bt->num_frames; i++) {
		__ast_mutex_logger("%s\n", strings[i]);
	}

	ast_std_free(strings);
}
Example #5
0
static void print_backtrace(struct ast_bt *bt)
{
	int i = 0;
	char **strings;

	if (!bt) {
		return;
	}

	if ((strings = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
		astmm_log("Memory allocation backtrace:\n");
		for (i = 3; i < bt->num_frames - 2; i++) {
			astmm_log("#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]);
		}
		ast_std_free(strings);
	}
}
/*!
 * \brief Free an \ref optional_api_user.
 *
 * \param user User struct to free.
 */
static void optional_api_user_destroy(struct optional_api_user *user)
{
	*user->optional_ref = user->stub;
	ast_std_free(user);
}