[osal]: add clear operation to mpp_free

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@210 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2008-01-29 23:29:40 +00:00
parent b56729adb9
commit 70090757a3
9 changed files with 17 additions and 25 deletions

View File

@@ -93,7 +93,6 @@ MPP_RET mpp_buf_slot_deinit(MppBufSlots slots)
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
delete impl->lock;
if (impl->slots)
mpp_free(impl->slots);
mpp_free(slots);
return MPP_OK;

View File

@@ -252,7 +252,7 @@ MPP_RET mpp_dec_init(MppDec **dec, MppCodingType coding)
// then init hal with task count from parser
MppHalCfg hal_cfg = {
MPP_CTX_DEC,
MPP_VIDEO_CodingAVC,
coding,
NULL,
parser_cfg.task_count,
};
@@ -279,7 +279,6 @@ MPP_RET mpp_dec_deinit(MppDec *dec)
return MPP_ERR_NULL_PTR;
}
if (dec->parser_ctx)
mpp_free(dec->parser_ctx);
if (dec->hal_ctx)

View File

@@ -83,7 +83,6 @@ MPP_RET mpp_hal_init(MppHal *ctx, MppHalCfg *cfg)
}
mpp_err_f("could not found coding type %d\n", cfg->coding);
if (p->ctx)
mpp_free(p->ctx);
mpp_free(p);
@@ -98,7 +97,6 @@ MPP_RET mpp_hal_deinit(MppHal ctx)
}
MppHalImpl *p = (MppHalImpl*)ctx;
if (p->ctx)
mpp_free(p->ctx);
if (p->tasks)
hal_task_group_deinit(p->tasks);

View File

@@ -224,14 +224,8 @@ RK_S32 vpu_close_context(VpuCodecContext **ctx)
delete api;
s->vpuApiObj = NULL;
}
if (s->extradata) {
mpp_free(s->extradata);
s->extradata = NULL;
}
if (s->private_data) {
mpp_free(s->private_data);
s->private_data = NULL;
}
mpp_free(s);
*ctx = s = NULL;

View File

@@ -224,7 +224,6 @@ MPP_RET mpp_deinit(MppCtx ctx)
if (p->ctx)
delete p->ctx;
if (p)
mpp_free(p);
MPI_FUNCTION_LEAVE();

View File

@@ -154,7 +154,6 @@ void Mpp::clear()
mpp_buffer_group_put(mFrameGroup);
mFrameGroup = NULL;
}
if (mTask)
mpp_free(mTask);
}

View File

@@ -58,7 +58,6 @@ MPP_RET mpp_packet_deinit(MppPacket *packet)
}
mpp_free(*packet);
*packet = NULL;
return MPP_OK;
}

View File

@@ -36,7 +36,13 @@
#define mpp_realloc(ptr, type, count) \
(type*)mpp_osal_realloc(MODULE_TAG, ptr, sizeof(type) * (count))
#define mpp_free(ptr) mpp_osal_free(ptr)
#define mpp_free(ptr) \
do { \
if (ptr) { \
mpp_osal_free(ptr); \
ptr = NULL; \
} \
} while (0)
#ifdef __cplusplus
extern "C" {

View File

@@ -121,7 +121,6 @@ MPP_RET mpp_alloctor_put(MppAllocator *allocator)
if (p->os_api.close)
p->os_api.close(p->ctx);
pthread_mutex_destroy(&p->lock);
if (p)
mpp_free(p);
return MPP_OK;