asan: abort in wasm_scan_name_function_section
authorAlan Modra <amodra@gmail.com>
Fri, 17 Dec 2021 04:24:54 +0000 (14:54 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Dec 2021 05:31:34 +0000 (16:01 +1030)
Macros like READ_LEB128 in wasm-module.c that alter control flow are
evil.  Maintainers will break your code if you have hidden ways to
reach labels.

* wasm-module.c (wasm_scan_name_function_section): Don't
attempt to bfd_release NULL.

bfd/wasm-module.c

index 9735ebeabca8be02e5ad10ee8aafbc815f46dbba..ca7e38179e9bf38f7870902766a913d2e6a1776c 100644 (file)
@@ -357,7 +357,8 @@ wasm_scan_name_function_section (bfd *abfd, sec_ptr asect)
   return true;
 
  error_return:
-  bfd_release (abfd, symbols);
+  if (symbols)
+    bfd_release (abfd, symbols);
   return false;
 }