/* C declarator syntax glue.
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of libctf.
for (cdp = ctf_list_next (&cd->cd_nodes[i]); cdp != NULL; cdp = ndp)
{
ndp = ctf_list_next (cdp);
- ctf_free (cdp);
+ free (cdp);
}
}
}
prec = CTF_PREC_BASE;
}
- if ((cdp = ctf_alloc (sizeof (ctf_decl_node_t))) == NULL)
+ if ((cdp = malloc (sizeof (ctf_decl_node_t))) == NULL)
{
cd->cd_err = EAGAIN;
return;
va_end (ap);
if (n > 0)
- cd->cd_buf = ctf_str_append (cd->cd_buf, str);
+ {
+ char *newbuf;
+ if ((newbuf = ctf_str_append (cd->cd_buf, str)) != NULL)
+ cd->cd_buf = newbuf;
+ }
/* Sticky error condition. */
- if (n < 0)
+ if (n < 0 || cd->cd_buf == NULL)
{
free (cd->cd_buf);
cd->cd_buf = NULL;