Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add missing error check.



details:   https://anonhg.NetBSD.org/src/rev/da56fd223ecd
branches:  trunk
changeset: 456092:da56fd223ecd
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Apr 22 11:10:52 2019 +0000

description:
Add missing error check.

diffstat:

 sys/net/if_media.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 84f077e9f0d6 -r da56fd223ecd sys/net/if_media.c
--- a/sys/net/if_media.c        Mon Apr 22 10:44:55 2019 +0000
+++ b/sys/net/if_media.c        Mon Apr 22 11:10:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_media.c,v 1.41 2019/04/16 06:48:33 msaitoh Exp $    */
+/*     $NetBSD: if_media.c,v 1.42 2019/04/22 11:10:52 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.41 2019/04/16 06:48:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.42 2019/04/22 11:10:52 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -342,6 +342,8 @@
                        int *kptr = malloc(minwords * sizeof(int), M_TEMP,
                            M_WAITOK);
 
+                       if (kptr == NULL)
+                               return ENOMEM;
                        /* Get the media words from the interface's list. */
                        ep = TAILQ_FIRST(&ifm->ifm_list);
                        for (count = 0; ep != NULL && count < minwords;



Home | Main Index | Thread Index | Old Index