From: Elan Ruusamäe Date: Sat, 17 Sep 2005 13:10:26 +0000 (+0000) Subject: - check for malloc failure X-Git-Tag: setup_2_4_11~20 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=abae7e08f91758598d8fb3494f709dbb46070411;hp=a904c8c2b46fae2ef9078aa373d87f9e66bbfedd;p=projects%2Fsetup.git - check for malloc failure Changed files: update-fstab.c -> 1.2 --- 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;