Fix a NULL pointer dereference.
This commit is contained in:
parent
0b0acf7336
commit
6df4f00822
@ -383,6 +383,10 @@ static struct directory_entry *parse_dirent(suunto_eonsteel_device_t *eon, int n
|
||||
p += 8 + namelen + 1;
|
||||
len -= 8 + namelen + 1;
|
||||
entry = alloc_dirent(type, namelen, (const char *) name);
|
||||
if (!entry) {
|
||||
ERROR(eon->base.context, "out of memory");
|
||||
break;
|
||||
}
|
||||
entry->next = old;
|
||||
old = entry;
|
||||
}
|
||||
|
||||
@ -479,6 +479,8 @@ suunto_eonsteel_parser_create(dc_parser_t **out, dc_context_t *context, unsigned
|
||||
return DC_STATUS_INVALIDARGS;
|
||||
|
||||
eon = (suunto_eonsteel_parser_t *) calloc(1, sizeof(*eon));
|
||||
if (!eon)
|
||||
return DC_STATUS_NOMEMORY;
|
||||
|
||||
parser_init(&eon->base, context, &suunto_eonsteel_parser_vtable);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user