git: 90603ee8e051 - stable/12 - loader: alloc_pread() should set errno if malloc fails

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 01:16:37 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=90603ee8e051807c5469e51b547d9dc856d9b6c8

commit 90603ee8e051807c5469e51b547d9dc856d9b6c8
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-23 15:21:15 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:59 +0000

    loader: alloc_pread() should set errno if malloc fails
    
    We may want to find out why alloc_pread() failed.
    
    (cherry picked from commit 91e697162c272aa81f375d3294e43cea97e8c4cd)
---
 stand/common/misc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/stand/common/misc.c b/stand/common/misc.c
index 315cbe8ce3bf..d85597522f8a 100644
--- a/stand/common/misc.c
+++ b/stand/common/misc.c
@@ -149,6 +149,7 @@ alloc_pread(readin_handle_t fd, off_t off, size_t len)
 #ifdef DEBUG
 		printf("\nmalloc(%d) failed\n", (int)len);
 #endif
+		errno = ENOMEM;
 		return (NULL);
 	}
 	if (VECTX_LSEEK(fd, off, SEEK_SET) == -1) {