]> git.ipfire.org Git - thirdparty/grub.git/commit
normal/completion: Add missing grub_malloc() failure check
authorAvnish Chouhan <avnish@linux.ibm.com>
Tue, 28 Oct 2025 16:31:59 +0000 (22:01 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Nov 2025 14:37:40 +0000 (15:37 +0100)
commitc0d2f76d55fcbf433b3525a3f3c4aa7d697b1105
treeb9341679ad8e7526e804efffecf94e659a8e5bf9
parent5f0ffd7f575447aab4c5bb8cfc08961971e9e767
normal/completion: Add missing grub_malloc() failure check

This patch adds a NULL check after grub_malloc() call. Missing a failure
check after calling grub_malloc() can lead to undefined behavior. If the
allocation fails and returns NULL subsequent dereferencing or writing to
the pointer will likely result in a runtime error such as a segmentation
fault.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/normal/completion.c