nanohub: drivers/st_mag40: (FIX) Remove mag calib data when task ends

Change-Id: I3c9f004e0c61ccf2f8c7a5330529512faab82c84
Signed-off-by: Armando Visconti <armando.visconti@st.com>
diff --git a/firmware/os/drivers/st_mag40/st_mag40.c b/firmware/os/drivers/st_mag40/st_mag40.c
index bdc874a..e61e26f 100644
--- a/firmware/os/drivers/st_mag40/st_mag40.c
+++ b/firmware/os/drivers/st_mag40/st_mag40.c
@@ -1024,6 +1024,9 @@
 static void endTask(void)
 {
     INFO_PRINT("ended\n");
+#if defined(ST_MAG40_CAL_ENABLED)
+    magCalDestroy(&mTask.moc);
+#endif /* ST_MAG40_CAL_ENABLED */
     slabAllocatorDestroy(mTask.magDataSlab);
     disableInterrupt(mTask.Int1, &mTask.Isr1);
 }