]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_c/Maasha/src/lib/common.c
updated upload_to_ucsc wiki and added a secure free to c code
[biopieces.git] / code_c / Maasha / src / lib / common.c
index 8203a2c971d48724f854e549b10423c307f6283b..c84a02a876243493507110c3238b6cc4b9b80dc0 100644 (file)
@@ -135,6 +135,22 @@ void mem_free( void *pt )
 }
 
 
+void mem_free_zero( void *pt )
+{
+    /* Martin A. Hansen, July 2008 */
+
+    /* Zero and then free memory from a given pointer. */
+
+    if ( pt != NULL )
+    {
+        ZERO( pt );
+        free( pt );
+
+        pt = NULL;
+    }
+}
+
+
 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ARRAYS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/