• Jakub Kicinski's avatar
    tools: ynl-gen: improve unwind on parsing errors · 58da455b
    Jakub Kicinski authored
    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>
    58da455b
ynl-gen-c.py 83.6 KB