Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/rpc avoid calloc(1,0).



details:   https://anonhg.NetBSD.org/src/rev/c7d910f56ed5
branches:  trunk
changeset: 353038:c7d910f56ed5
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Apr 18 11:35:34 2017 +0000

description:
avoid calloc(1,0).
from clang static analyzer

ok christos

diffstat:

 lib/libc/rpc/svc_fdset.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r f37f103dcd1e -r c7d910f56ed5 lib/libc/rpc/svc_fdset.c
--- a/lib/libc/rpc/svc_fdset.c  Tue Apr 18 10:49:35 2017 +0000
+++ b/lib/libc/rpc/svc_fdset.c  Tue Apr 18 11:35:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc_fdset.c,v 1.15 2015/11/10 20:56:20 christos Exp $  */
+/*     $NetBSD: svc_fdset.c,v 1.16 2017/04/18 11:35:34 maya Exp $      */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: svc_fdset.c,v 1.15 2015/11/10 20:56:20 christos Exp $");
+__RCSID("$NetBSD: svc_fdset.c,v 1.16 2017/04/18 11:35:34 maya Exp $");
 
 
 #include "reentrant.h"
@@ -387,6 +387,8 @@
 svc_fdset_copy(const fd_set *orig)
 {
        int size = svc_fdset_getsize(0);
+       if (size == -1)
+               return NULL;
        fd_set *copy = calloc(1, __NFD_BYTES(size));
        if (copy == NULL)
                return NULL;



Home | Main Index | Thread Index | Old Index