From ed1591688000a5d179c4ba27793cae55590c55d2 Mon Sep 17 00:00:00 2001 From: Richard PALO Date: Wed, 4 Feb 2015 09:44:00 +0100 Subject: [PATCH] =?utf8?q?5590=20improper=20use=20of=20NULL=20in=20tools/p?= =?utf8?q?rotocmp=20Reviewed=20by:=20David=20H=C3=B6ppner=20<0xffea@gmail.?= =?utf8?q?com>=20Approved=20by:=20Dan=20McDonald=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- usr/src/tools/protocmp/exception_list.c | 8 +++++++- usr/src/tools/protocmp/protocmp.c | 8 +++----- usr/src/tools/protocmp/protodir.c | 5 +---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/usr/src/tools/protocmp/exception_list.c b/usr/src/tools/protocmp/exception_list.c index 5dd98fb6fe..f44f5296e9 100644 --- a/usr/src/tools/protocmp/exception_list.c +++ b/usr/src/tools/protocmp/exception_list.c @@ -22,6 +22,8 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 PALO, Richard */ #include @@ -56,6 +58,10 @@ parse_exception_line(char *line, elem_list *list) } e = (elem *) malloc(sizeof (elem)); + if (e == NULL) { + perror("malloc"); + exit(1); + } e->inode = 0; e->perm = 0; @@ -68,7 +74,7 @@ parse_exception_line(char *line, elem_list *list) e->symsrc = NULL; e->file_type = DIR_T; - while ((e->arch = assign_arch(arch)) == NULL) { + while ((e->arch = assign_arch(arch)) == 0) { if ((arch = strtok(NULL, FS)) == NULL) { return (0); } diff --git a/usr/src/tools/protocmp/protocmp.c b/usr/src/tools/protocmp/protocmp.c index a2897477cb..4cd1b56eb2 100644 --- a/usr/src/tools/protocmp/protocmp.c +++ b/usr/src/tools/protocmp/protocmp.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -685,7 +683,7 @@ main(int argc, char **argv) { int errflg = 0; int i, c; - int list_filtered_exceptions = NULL; + int list_filtered_exceptions = 0; int n_proto_refs = 0; int n_exception_files = 0; char *proto_refs[MAX_PROTO_REFS]; @@ -729,7 +727,7 @@ main(int argc, char **argv) errflg++; (void) fprintf(stderr, "Only %d exception files supported\n", - MAX_EXCEPTION_FILES); + MAX_EXCEPTION_FILES); } else { exception_files[n_exception_files++] = optarg; } @@ -745,7 +743,7 @@ main(int argc, char **argv) errflg++; (void) fprintf(stderr, "Only %d proto references supported\n", - MAX_PROTO_REFS); + MAX_PROTO_REFS); } else { proto_refs[n_proto_refs++] = optarg; } diff --git a/usr/src/tools/protocmp/protodir.c b/usr/src/tools/protocmp/protodir.c index 352c36a8b2..520f5359f3 100644 --- a/usr/src/tools/protocmp/protodir.c +++ b/usr/src/tools/protocmp/protodir.c @@ -24,9 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - - #include #include #include @@ -424,7 +421,7 @@ read_pkginfo(const char *protodir, short *arch, char *basedir) (void) fclose(pkginfo_fp); if (architecture[0]) - if ((*arch = assign_arch(architecture)) == NULL) { + if ((*arch = assign_arch(architecture)) == 0) { (void) fprintf(stderr, "warning: Unknown architecture %s found in %s\n", architecture, pkginfofile); -- 2.11.4.GIT