aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/plugin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index e982869..f81ab02 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -506,7 +506,9 @@ add_symbols (void *handle, int nsyms, const struct ld_plugin_symbol *syms)
int n;
ASSERT (called_plugin);
- symptrs = xmalloc (nsyms * sizeof *symptrs);
+ symptrs = bfd_alloc (abfd, nsyms * sizeof *symptrs);
+ if (symptrs == NULL)
+ return LDPS_ERR;
for (n = 0; n < nsyms; n++)
{
enum ld_plugin_status rv;
@@ -514,6 +516,8 @@ add_symbols (void *handle, int nsyms, const struct ld_plugin_symbol *syms)
bfdsym = bfd_make_empty_symbol (abfd);
symptrs[n] = bfdsym;
+ if (bfdsym == NULL)
+ return LDPS_ERR;
rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
if (rv != LDPS_OK)
return rv;