Avoid dereferencing/free()ing invalid pointers if the random device
cannot be opened. OK'd by elric.
This commit is contained in:
parent
2bcbb9cb72
commit
3db339be14
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utils.c,v 1.3 2003/09/23 17:24:46 cb Exp $ */
|
||||
/* $NetBSD: utils.c,v 1.4 2004/08/10 02:27:26 rumble 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.3 2003/09/23 17:24:46 cb Exp $");
|
||||
__RCSID("$NetBSD: utils.c,v 1.4 2004/08/10 02:27:26 rumble Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -464,11 +464,8 @@ bits_cget(const char *fn, int len)
|
|||
FILE *f;
|
||||
|
||||
f = fopen(fn, "r");
|
||||
if (!f) {
|
||||
free(bits->text);
|
||||
free(bits);
|
||||
if (!f)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bits = bits_fget(f, len);
|
||||
fclose(f);
|
||||
|
|
Loading…
Reference in New Issue