[syslinux:pathbased] lmalloc: set errno on failure

syslinux-bot for H. Peter Anvin hpa at zytor.com
Wed Feb 24 12:03:03 PST 2010


Commit-ID:  6d49c6741e71722a1c25bc1d7db30e6833898f9e
Gitweb:     http://syslinux.zytor.com/commit/6d49c6741e71722a1c25bc1d7db30e6833898f9e
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 24 Feb 2010 11:58:42 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 24 Feb 2010 11:58:42 -0800

lmalloc: set errno on failure

The core function can't set the com32 errno, so we need to do it in
the wrapper.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/lib/lmalloc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/com32/lib/lmalloc.c b/com32/lib/lmalloc.c
index a73817e..cbd39a3 100644
--- a/com32/lib/lmalloc.c
+++ b/com32/lib/lmalloc.c
@@ -26,12 +26,17 @@
  * ----------------------------------------------------------------------- */
 
 #include <com32.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <syslinux/pmapi.h>
 
 void *lmalloc(size_t size)
 {
-    return __com32.cs_pm->lmalloc(size);
+    void *p;
+    p = __com32.cs_pm->lmalloc(size);
+    if (!p)
+	errno = ENOMEM;
+    return p;
 }
 
 void lfree(void *ptr)



More information about the Syslinux-commits mailing list