mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-22 18:42:34 +00:00
as/tunit.c: check for NULL before applying container_of()
This commit is contained in:
parent
772d5e4061
commit
a5a68a70b7
@ -48,7 +48,7 @@ static uintptr_t string_hash(const char *string)
|
||||
*/
|
||||
static struct section *section_from_hashnode(const struct hashnode *hashnode)
|
||||
{
|
||||
return container_of(hashnode, struct section, hashnode);
|
||||
return hashnode ? container_of(hashnode, struct section, hashnode) : NULL;
|
||||
}
|
||||
|
||||
static int section_eq(const struct hashnode *hashnode, const void *data)
|
||||
@ -195,7 +195,7 @@ void strtab_init(struct strtab *strtab, const char *name)
|
||||
*/
|
||||
static struct symbol *symbol_from_hashnode(const struct hashnode *hashnode)
|
||||
{
|
||||
return container_of(hashnode, struct symbol, hashnode);
|
||||
return hashnode ? container_of(hashnode, struct symbol, hashnode) : NULL;
|
||||
}
|
||||
|
||||
static int symbol_eq(const struct hashnode *hashnode, const void *data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user