Missing NULL check

Alan Modra amodra@gmail.com
Wed Sep 13 06:50:24 GMT 2023


On Tue, Sep 12, 2023 at 05:40:45PM +0200, jacob navia wrote:
> Add
> if (list == NULL) return NULL;

Yes, we should be testing for a NULL return from bfd_alloc, but error
handling then needs to be propagated up the call chain.  If
elf_new_obj_attr returns NULL then all its callers will segfault
unless they are changed too.  We also don't want to hide allocation
failures which means functions like bfd_elf_add_obj_attr_int should
return the obj_attribute pointer rather than void, and all callers
should check the return value.  I'll write a patch to do that.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list