ソースを参照

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 年 前
コミット
3ccb9c819b
1 ファイル変更2 行追加2 行削除
  1. 2 2
      rpc_lookup.c

+ 2 - 2
rpc_lookup.c

@@ -67,8 +67,8 @@ void destroy_rpcs()
 			pkg_free(e);
 			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.table=0;
 	rpc_hash_table.size=0;
 	rpc_hash_table.size=0;
 	rpc_sarray=0;
 	rpc_sarray=0;