]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add small sanity check to libsofia
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 May 2007 21:05:22 +0000 (21:05 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 May 2007 21:05:22 +0000 (21:05 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5194 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c

index 758f46762b013a9fad90e697b99c58c32406040a..1e27d51f6ca79de0541d87935e0d0db17a158711 100644 (file)
@@ -929,7 +929,7 @@ int su_home_init(su_home_t *home)
 
   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 @@ void _su_home_deinit(su_home_t *home)
        }
        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;