Skip to content

Commit

Permalink
[Encode] Fix kw issue
Browse files Browse the repository at this point in the history
Refactor to avoid use of freed memory
  • Loading branch information
perrchen authored and intel-mediadev committed Aug 31, 2023
1 parent 55b8982 commit 243c523
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@
#define CODECHAL_ENCODE_CHK_NULL_WITH_DESTROY_RETURN(_ptr, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (nullptr == _ptr), destroyFunction, MOS_STATUS_NULL_POINTER, "error nullptr!")

#define CODECHAL_ENCODE_CHK_STATUS_WITH_DESTROY_RETURN(_stmt, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (MOS_STATUS_SUCCESS != _stmt), destroyFunction, _stmt, "error status!")
#define CODECHAL_ENCODE_CHK_STATUS_WITH_DESTROY_RETURN(_stmt, destroyFunction) \
{ \
MOS_STATUS sts = (MOS_STATUS)(_stmt); \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (MOS_STATUS_SUCCESS != sts), destroyFunction, sts, "error status!") \
}

// User Feature Report Writeout
#define CodecHalEncode_WriteKey64(key, value, mosCtx)\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ enum HuCFunction
#define ENCODE_CHK_NULL_WITH_DESTROY_RETURN_VALUE(_ptr, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (nullptr == _ptr), destroyFunction, MOS_STATUS_NULL_POINTER, "error nullptr!")

#define ENCODE_CHK_STATUS_WITH_DESTROY_RETURN_VALUE(_stmt, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (MOS_STATUS_SUCCESS != _stmt), destroyFunction, _stmt, "error status!")
#define ENCODE_CHK_STATUS_WITH_DESTROY_RETURN_VALUE(_stmt, destroyFunction) \
{ \
MOS_STATUS sts = (MOS_STATUS)(_stmt); \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_ENCODE, (MOS_STATUS_SUCCESS != sts), destroyFunction, sts, "error status!") \
}

namespace encode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ class MhwCpInterface;
#define RENDER_PACKET_CHK_NULL_WITH_DESTROY_RETURN_VALUE(_ptr, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_HW, 0, (nullptr == _ptr), destroyFunction, MOS_STATUS_NULL_POINTER, "error nullptr!")

#define RENDER_PACKET_CHK_STATUS_WITH_DESTROY_RETURN_VALUE(_stmt, destroyFunction) \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_HW, 0, (MOS_STATUS_SUCCESS != _stmt), destroyFunction, _stmt, "error status!")
#define RENDER_PACKET_CHK_STATUS_WITH_DESTROY_RETURN_VALUE(_stmt, destroyFunction) \
{ \
MOS_STATUS sts = (MOS_STATUS)(_stmt); \
MOS_CHK_COND_WITH_DESTROY_RETURN_VALUE(MOS_COMPONENT_HW, 0, (MOS_STATUS_SUCCESS != sts), destroyFunction, sts, "error status!") \
}

//!
//! \brief Initialize MHW Kernel Param struct for loading Kernel
Expand Down

0 comments on commit 243c523

Please sign in to comment.