From abae7e08f91758598d8fb3494f709dbb46070411 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 17 Sep 2005 13:10:26 +0000 Subject: [PATCH 1/1] - check for malloc failure Changed files: update-fstab.c -> 1.2 --- update-fstab.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/update-fstab.c b/update-fstab.c index 34fb649..9a85d2f 100644 --- a/update-fstab.c +++ b/update-fstab.c @@ -36,6 +36,10 @@ int main() } fstat(fd, &st); old = (char *) malloc(st.st_size); + if (old == NULL) { + eputs("\nError: malloc failure\n"); + return 1; + } read(fd, old, st.st_size); close(fd); old_sz = st.st_size; -- 2.44.0