Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A1 by
Revision 76:88d48e64bac2, committed 2016-05-31
- Comitter:
- mapellil
- Date:
- Tue May 31 13:22:48 2016 +0000
- Parent:
- 75:8a5184f66cd9
- Child:
- 82:97e3e1cffcfd
- Commit message:
- Added X_NUCLEO_IKS01A1 to fix memory leak
Changed in this revision
| x_nucleo_iks01a1.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/x_nucleo_iks01a1.h Thu Dec 17 07:18:13 2015 +0000
+++ b/x_nucleo_iks01a1.h Tue May 31 13:22:48 2016 +0000
@@ -119,6 +119,16 @@
PinName ff_irq_pin = IKS01A1_PIN_FF);
static X_NUCLEO_IKS01A1* Instance(PinName sda, PinName scl, PinName ff_irq_pin = NC);
+ /**
+ * @brief Destructor
+ */
+ ~X_NUCLEO_IKS01A1(){
+ //if(dev_i2c!=NULL){ delete dev_i2c; dev_i2c=0; } how to understand if dev_i2c is locally allocated (so it must be deleted) or comes from constructors args?
+ if(ht_sensor!=NULL){ delete ht_sensor; ht_sensor=NULL; }
+ if(magnetometer!=NULL){ delete magnetometer; magnetometer=NULL; }
+ if(pt_sensor!=NULL){ delete pt_sensor; pt_sensor=NULL; }
+ }
+
DevI2C *dev_i2c;
HTS221 *ht_sensor;
