Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/vndcompress Fail if malloc can't allocate offset table.



details:   https://anonhg.NetBSD.org/src/rev/b2110821c8d2
branches:  trunk
changeset: 326190:b2110821c8d2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jan 22 06:14:03 2014 +0000

description:
Fail if malloc can't allocate offset table.

diffstat:

 usr.bin/vndcompress/vnduncompress.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 0de822a825c6 -r b2110821c8d2 usr.bin/vndcompress/vnduncompress.c
--- a/usr.bin/vndcompress/vnduncompress.c       Wed Jan 22 01:03:09 2014 +0000
+++ b/usr.bin/vndcompress/vnduncompress.c       Wed Jan 22 06:14:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnduncompress.c,v 1.2 2013/05/06 22:53:24 riastradh Exp $      */
+/*     $NetBSD: vnduncompress.c,v 1.3 2014/01/22 06:14:03 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: vnduncompress.c,v 1.2 2013/05/06 22:53:24 riastradh Exp $");
+__RCSID("$NetBSD: vnduncompress.c,v 1.3 2014/01/22 06:14:03 riastradh Exp $");
 
 #include <sys/endian.h>
 
@@ -109,6 +109,8 @@
 
        __CTASSERT(MAX_N_OFFSETS <= (SIZE_MAX / sizeof(uint64_t)));
        uint64_t *const offset_table = malloc(n_offsets * sizeof(uint64_t));
+       if (offset_table == NULL)
+               err(1, "malloc offset table");
 
        /* Read the offset table in.  */
        const ssize_t ot_read = read(cloop2_fd, offset_table,



Home | Main Index | Thread Index | Old Index