Browse Source

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 16 years ago
parent
commit
3ccb9c819b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rpc_lookup.c

+ 2 - 2
rpc_lookup.c

@@ -67,8 +67,8 @@ void destroy_rpcs()
 			pkg_free(e);
 		}
 	}
-	pkg_free(rpc_hash_table.table);
-	pkg_free(rpc_sarray);
+	if (rpc_hash_table.table) pkg_free(rpc_hash_table.table);
+	if (rpc_sarray) pkg_free(rpc_sarray);
 	rpc_hash_table.table=0;
 	rpc_hash_table.size=0;
 	rpc_sarray=0;