Jonathan Gaul / DigitalOutEx

Dependents:   Car_Simulator

Files at this revision

API Documentation at this revision

Comitter:
Byrn
Date:
Fri Apr 26 11:31:13 2013 +0000
Parent:
0:1798e1bf583a
Commit message:
Fixed a memory leak (I am an idiot).

Changed in this revision

DigitalOutEx.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DigitalOutEx.cpp	Fri Apr 26 10:31:31 2013 +0000
+++ b/DigitalOutEx.cpp	Fri Apr 26 11:31:13 2013 +0000
@@ -25,8 +25,11 @@
 void DigitalOutEx::stop_flashing() {
     if (!_flashing) return;
     
-    _flashThread->terminate();
-    _flashThread = NULL;
+    if (_flashThread != NULL) {
+        _flashThread->terminate();
+        delete _flashThread;
+        _flashThread = NULL;
+    }
     _flashing = 0;
 }