Browse code

core: destroy_rpcs fix: don't try to free unalloc. data

destroy_rpcs() can be called without init_rpcs() being called
first (e.g. unknown command line param) => don't blindly free
everything, check first if the arrays were allocated.

Andrei Pelinescu-Onciul authored on 29/05/2009 09:07:20
Showing 1 changed files
... ...
@@ -67,8 +67,8 @@ void destroy_rpcs()
67 67
 			pkg_free(e);
68 68
 		}
69 69
 	}
70
-	pkg_free(rpc_hash_table.table);
71
-	pkg_free(rpc_sarray);
70
+	if (rpc_hash_table.table) pkg_free(rpc_hash_table.table);
71
+	if (rpc_sarray) pkg_free(rpc_sarray);
72 72
 	rpc_hash_table.table=0;
73 73
 	rpc_hash_table.size=0;
74 74
 	rpc_sarray=0;