Skip to content
Browse files

Updated to check for NULL

  • Loading branch information...
1 parent ef0fb30 commit 636e2e980245380aa0bdf3fd0cc1bb4b9fe07cad @schuchert committed Oct 7, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 CommonMemory.h
View
6 CommonMemory.h
@@ -5,10 +5,12 @@
#ifdef CPPUTEST_USE_MEM_LEAK_DETECTION
#include <CppUTest/TestHarness_c.h>
#define acquire(s) cpputest_malloc_location((s), __FILE__, __LINE__)
-#define release(s) cpputest_free_location((s), __FILE__, __LINE__)
+#define release(s) if(s != NULL) cpputest_free_location((s), __FILE__, __LINE__)
#else
+#include <memory.h>
+#include <stddef.h>
#define acquire(s) malloc((s))
-#define release(s) free((s))
+#define release(s) if(s != NULL) free(s)
#endif
#include <stdlib.h>

0 comments on commit 636e2e9

Please sign in to comment.
Something went wrong with that request. Please try again.