Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
3ccb9c819b
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  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;