Module Name: src
Committed By: maya
Date: Sun Apr 16 20:00:59 UTC 2017
Modified Files:
src/usr.bin/make: main.c parse.c
Log Message:
Use bmake_malloc where we don't test the return value of malloc currently.
Appeases coverity.
To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/main.c
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/parse.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.260 src/usr.bin/make/main.c:1.261
--- src/usr.bin/make/main.c:1.260 Thu Apr 13 13:55:23 2017
+++ src/usr.bin/make/main.c Sun Apr 16 20:00:58 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $ */
+/* $NetBSD: main.c,v 1.261 2017/04/16 20:00:58 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.261 2017/04/16 20:00:58 maya Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.261 2017/04/16 20:00:58 maya Exp $");
#endif
#endif /* not lint */
#endif
@@ -323,7 +323,7 @@ parse_debug_options(const char *argvalue
goto debug_setbuf;
}
len = strlen(modules);
- fname = malloc(len + 20);
+ fname = bmake_malloc(len + 20);
memcpy(fname, modules, len + 1);
/* Let the filename be modified by the pid */
if (strcmp(fname + len - 3, ".%d") == 0)
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.219 src/usr.bin/make/parse.c:1.220
--- src/usr.bin/make/parse.c:1.219 Sun Apr 16 19:53:58 2017
+++ src/usr.bin/make/parse.c Sun Apr 16 20:00:58 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.219 2017/04/16 19:53:58 riastradh Exp $ */
+/* $NetBSD: parse.c,v 1.220 2017/04/16 20:00:58 maya Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.219 2017/04/16 19:53:58 riastradh Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.220 2017/04/16 20:00:58 maya Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.219 2017/04/16 19:53:58 riastradh Exp $");
+__RCSID("$NetBSD: parse.c,v 1.220 2017/04/16 20:00:58 maya Exp $");
#endif
#endif /* not lint */
#endif
@@ -527,7 +527,7 @@ loadfile(const char *path, int fd)
if (lf->buf != MAP_FAILED) {
/* succeeded */
if (lf->len == lf->maplen && lf->buf[lf->len - 1] != '\n') {
- char *b = malloc(lf->len + 1);
+ char *b = bmake_malloc(lf->len + 1);
b[lf->len] = '\n';
memcpy(b, lf->buf, lf->len++);
munmap(lf->buf, lf->maplen);