diff options
author | Renchao Liu <rencliu@codeaurora.org> | 2021-02-03 16:37:14 +0800 |
---|---|---|
committer | Renchao Liu <rencliu@codeaurora.org> | 2021-09-17 16:23:36 +0800 |
commit | 5bff3c10e52c759b51cf3ae9e8968558d5b8cce3 (patch) | |
tree | 02479ac5170f082ee3d6d8408b22fc3c1dede21e /sdm | |
parent | ae684acc368b27a09b44ceb457981e7415194f88 (diff) |
sdm: Assign null pointer when object is deleted
Assign null pointer when object is deleted, this will help others to check
whether the object is released or not.
Change-Id: Ieca455980426ab8fc0fe0bdf93d2d4dc69ae8d10
Diffstat (limited to 'sdm')
-rw-r--r-- | sdm/include/private/color_params.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/sdm/include/private/color_params.h b/sdm/include/private/color_params.h index 835b1a70..9b84483f 100644 --- a/sdm/include/private/color_params.h +++ b/sdm/include/private/color_params.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -395,8 +395,10 @@ class SDEPADitherWrapper : private SDEPADitherData { public: static SDEPADitherWrapper *Init(uint32_t arg __attribute__((__unused__))); ~SDEPADitherWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } inline SDEPADitherData *GetConfig(void) { return this; } @@ -435,6 +437,10 @@ struct SDEPaData { uint32_t six_zone_len = 0; uint32_t *six_zone_curve_p0 = NULL; uint32_t *six_zone_curve_p1 = NULL; + ~SDEPaData() { + six_zone_curve_p0 = nullptr; + six_zone_curve_p1 = nullptr; + } }; struct SDEIgcLUTData { @@ -485,8 +491,10 @@ class SDEGamutCfgWrapper : private SDEGamutCfg { // Data consumer<Commit thread> will be responsible to destroy it once the feature is commited. ~SDEGamutCfgWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } // Data consumer will use this method to retrieve contained feature configuration. @@ -501,8 +509,10 @@ class SDEPaCfgWrapper : private SDEPaData { public: static SDEPaCfgWrapper *Init(uint32_t arg = 0); ~SDEPaCfgWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } inline SDEPaData *GetConfig(void) { return this; } @@ -515,8 +525,10 @@ class SDEIgcLUTWrapper : private SDEIgcLUTData { public: static SDEIgcLUTWrapper *Init(uint32_t arg __attribute__((__unused__))); ~SDEIgcLUTWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } inline SDEIgcLUTData *GetConfig(void) { return this; } @@ -529,8 +541,10 @@ class SDEIgcV30LUTWrapper : private SDEIgcV30LUTData { public: static SDEIgcV30LUTWrapper *Init(uint32_t arg __attribute__((__unused__))); ~SDEIgcV30LUTWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } inline SDEIgcV30LUTData *GetConfig(void) { return this; } @@ -546,8 +560,10 @@ class SDEPgcLUTWrapper : private SDEPgcLUTData { public: static SDEPgcLUTWrapper *Init(uint32_t arg __attribute__((__unused__))); ~SDEPgcLUTWrapper() { - if (buffer_) + if (buffer_) { delete[] buffer_; + buffer_ = nullptr; + } } inline SDEPgcLUTData *GetConfig(void) { return this; } @@ -564,8 +580,10 @@ template <typename T> class TPPFeatureInfo : public PPFeatureInfo { public: virtual ~TPPFeatureInfo() { - if (params_) + if (params_) { delete params_; + params_ = nullptr; + } } // API for data consumer to get underlying data configs to program into pp hardware block. |