dwarf_loader: Use zalloc() to allocate dwarf_cu
We were allocating it with malloc and then trying to initialize it with dwarf_cu__init(), which may fail and leave the dwarf_cu instance not completely initialized which would lead to problems when calling dwarf_cu__delete(), use zalloc to make sure all is zeroed. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f3957627bb
commit
3ba54ee43a
|
@ -2639,7 +2639,7 @@ static int cus__merge_and_process_cu(struct cus *cus, struct conf_load *conf,
|
|||
if (cu == NULL || cu__set_common(cu, conf, mod, elf) != 0)
|
||||
return DWARF_CB_ABORT;
|
||||
|
||||
dcu = malloc(sizeof(struct dwarf_cu));
|
||||
dcu = zalloc(sizeof(*dcu));
|
||||
if (dcu == NULL)
|
||||
return DWARF_CB_ABORT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue