]> git.ipfire.org Git - thirdparty/grub.git/commit
normal/completion: Fix leaking of memory when processing a completion
authorDarren Kenny <darren.kenny@oracle.com>
Fri, 4 Dec 2020 18:56:48 +0000 (18:56 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:17 +0000 (15:54 +0100)
commit9213575b7a95b514bce80be5964a28d407d7d56d
tree7dccd57f846f5d17f1eae5798819bf0e8d4a5af5
parent95bc016dba94cab3d398dd74160665915cd08ad6
normal/completion: Fix leaking of memory when processing a completion

It is possible for the code to reach the end of the function without
freeing the memory allocated to argv and argc still to be 0.

We should always call grub_free(argv). The grub_free() will handle
a NULL argument correctly if it reaches that code without the memory
being allocated.

Fixes: CID 96672
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/normal/completion.c