[Freeswitch-svn] [commit] r5194 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su

Freeswitch SVN anthm at freeswitch.org
Wed May 16 17:05:22 EDT 2007


Author: anthm
Date: Wed May 16 17:05:22 2007
New Revision: 5194

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c

Log:
add small sanity check to libsofia

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c	Wed May 16 17:05:22 2007
@@ -929,7 +929,7 @@
 
   return 0;
 }
-
+#define safe_free(it) if (it) { free(it); it = NULL; }
 /** Internal deinitialization */
 static
 void _su_home_deinit(su_home_t *home)
@@ -965,16 +965,17 @@
 	}
 	else if (su_is_preloaded(b, b->sub_nodes[i].sua_data))
 	  continue;
-	free(b->sub_nodes[i].sua_data);
+	safe_free(b->sub_nodes[i].sua_data);
+	
       }
     }
 
     if (b->sub_preload && !b->sub_preauto)
-      free(b->sub_preload);
+      safe_free(b->sub_preload);
     if (b->sub_stats)
-      free(b->sub_stats);
+		safe_free(b->sub_stats);
     if (!b->sub_auto)
-      free(b);
+      safe_free(b);
 
     home->suh_blocks = NULL;
 



More information about the Freeswitch-svn mailing list