diff options
author | qctecmdr <qctecmdr@localhost> | 2021-09-29 21:22:31 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2021-09-29 21:22:31 -0700 |
commit | 60f409a2919ad35a238d2d12aa0f7acad2343125 (patch) | |
tree | c5ddfe4c5abd2921e8666c85d503c45867d71697 | |
parent | b83651dc7a690a13eccb0757dd5d10787670bc4f (diff) | |
parent | 5bff3c10e52c759b51cf3ae9e8968558d5b8cce3 (diff) |
Merge "sdm: Assign null pointer when object is deleted"
-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. |