mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[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:
@@ -93,8 +93,7 @@ MPP_RET mpp_buf_slot_deinit(MppBufSlots slots)
|
||||
|
||||
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
|
||||
delete impl->lock;
|
||||
if (impl->slots)
|
||||
mpp_free(impl->slots);
|
||||
mpp_free(impl->slots);
|
||||
mpp_free(slots);
|
||||
return MPP_OK;
|
||||
}
|
||||
|
@@ -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,8 +279,7 @@ MPP_RET mpp_dec_deinit(MppDec *dec)
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
if (dec->parser_ctx)
|
||||
mpp_free(dec->parser_ctx);
|
||||
mpp_free(dec->parser_ctx);
|
||||
|
||||
if (dec->hal_ctx)
|
||||
mpp_hal_deinit(dec->hal_ctx);
|
||||
|
@@ -83,8 +83,7 @@ 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->ctx);
|
||||
mpp_free(p);
|
||||
|
||||
return MPP_NOK;
|
||||
@@ -98,8 +97,7 @@ MPP_RET mpp_hal_deinit(MppHal ctx)
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
if (p->ctx)
|
||||
mpp_free(p->ctx);
|
||||
mpp_free(p->ctx);
|
||||
if (p->tasks)
|
||||
hal_task_group_deinit(p->tasks);
|
||||
mpp_free(p);
|
||||
|
@@ -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->extradata);
|
||||
mpp_free(s->private_data);
|
||||
mpp_free(s);
|
||||
*ctx = s = NULL;
|
||||
|
||||
|
@@ -224,8 +224,7 @@ MPP_RET mpp_deinit(MppCtx ctx)
|
||||
if (p->ctx)
|
||||
delete p->ctx;
|
||||
|
||||
if (p)
|
||||
mpp_free(p);
|
||||
mpp_free(p);
|
||||
|
||||
MPI_FUNCTION_LEAVE();
|
||||
return MPP_OK;
|
||||
|
@@ -154,8 +154,7 @@ void Mpp::clear()
|
||||
mpp_buffer_group_put(mFrameGroup);
|
||||
mFrameGroup = NULL;
|
||||
}
|
||||
if (mTask)
|
||||
mpp_free(mTask);
|
||||
mpp_free(mTask);
|
||||
}
|
||||
|
||||
MPP_RET Mpp::put_packet(MppPacket packet)
|
||||
|
@@ -58,7 +58,6 @@ MPP_RET mpp_packet_deinit(MppPacket *packet)
|
||||
}
|
||||
|
||||
mpp_free(*packet);
|
||||
*packet = NULL;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
|
@@ -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" {
|
||||
|
@@ -121,8 +121,7 @@ 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);
|
||||
mpp_free(p);
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user