Skip to content
Snippets Groups Projects
Commit 58da455b authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

tools: ynl-gen: improve unwind on parsing errors


When parsing multi-attr we count the objects and then allocate
an array to hold the parsed objects. If an attr space has multiple
multi-attr objects, however, if parsing the first array fails
we'll leave the object count for the second even tho the second
array was never allocated.

This may cause crashes when freeing objects on error.

Count attributes to a variable on the stack and only set the count
in the object once the memory was allocated.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2cc9671a
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment