Source-Changes-HG archive

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

[src/netbsd-3]: src/sbin/cgdconfig Pull up revision 1.8 (requested by lukem i...



details:   https://anonhg.NetBSD.org/src/rev/d0964f17af06
branches:  netbsd-3
changeset: 576223:d0964f17af06
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Jun 14 21:43:33 2005 +0000

description:
Pull up revision 1.8 (requested by lukem in ticket #404):
Avoid dereferencing/free()ing invalid pointers if the random device
cannot be opened.
Detected with gcc -Wuninitialized.
(The bug was fixed in rev 1.4 by rumble but reintroduced in rev 1.5 by tv !)

diffstat:

 sbin/cgdconfig/utils.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 6d3f04c4492f -r d0964f17af06 sbin/cgdconfig/utils.c
--- a/sbin/cgdconfig/utils.c    Tue Jun 14 21:42:30 2005 +0000
+++ b/sbin/cgdconfig/utils.c    Tue Jun 14 21:43:33 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.5 2004/08/13 15:03:57 tv Exp $ */
+/* $NetBSD: utils.c,v 1.5.2.1 2005/06/14 21:43:33 tron Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: utils.c,v 1.5 2004/08/13 15:03:57 tv Exp $");
+__RCSID("$NetBSD: utils.c,v 1.5.2.1 2005/06/14 21:43:33 tron Exp $");
 #endif
 
 #include <sys/param.h>
@@ -464,11 +464,8 @@
        FILE    *f;
 
        f = fopen(fn, "r");
-       if (!f) {
-               free(bits->text);
-               free(bits);
+       if (!f)
                return NULL;
-       }
 
        bits = bits_fget(f, len);
        fclose(f);



Home | Main Index | Thread Index | Old Index