jfrimmel / cargo-valgrind

A cargo subcommand, that runs valgrind and displays its output in a helpful manner.

Home Page:https://crates.io/crates/cargo-valgrind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid Free causes parsing the valgrind output to fail

jfrimmel opened this issue · comments

If you have an invalid free, cargo-valgrind currently exits with an error. This is due to a changed Valgrind XML:

<error>
  <unique>...</unique>
  <tid>...</tid>
  <kind>InvalidFree</kind>
  <what>Invalid free() / delete / delete[] / realloc()</what>
  <stack>...</stack>
  <auxwhat>Address 0x8c2b840 is 0 bytes inside a block of size 16 free'd</auxwhat>
  <stack>...</stack>
  <auxwhat>Block was alloc'd at</auxwhat>
  <stack>...</stack>
</error>

Note the multiple stack fields.

To resolve this error the stack Error structure has to be changed, so that it provides a vector of Stacks.
Since the valgrind_xml module is not public, the change won't not API breaking.

At this point, the <auxwhat>-block should also be parsed and maybe presented to the user.

This requires to parse either a Resources struct in case of <xwhat> or a String in case of what. The same applies for auxwhat/xauxwhat.
Refer to the serde documentation on that topic.