Skip to content

Commit

Permalink
delete allocated array properly (iovisor#2285)
Browse files Browse the repository at this point in the history
In bcc_btf.cc, new_btf_sec is allocated with something like
   new_btf_sec = new uint8_t[tmp_sec_size]

Since the allocation is an array, the deletion should be
   delete[] new_btf_sec
instead of
   delete new_btf_sec

This patch fixed the problem.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Mar 21, 2019
1 parent 5570f70 commit c72f628
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cc/bcc_btf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int BTF::load(uint8_t *btf_sec, uintptr_t btf_sec_size,

if (new_btf_sec) {
btf = btf__new(new_btf_sec, new_btf_sec_size);
delete new_btf_sec;
delete[] new_btf_sec;
} else {
btf = btf__new(btf_sec, btf_sec_size);
}
Expand Down

0 comments on commit c72f628

Please sign in to comment.