From a382cfbd0d0878926dd5eb700cc22d4ba7b6d80f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 4 Mar 2007 22:37:19 +0000 Subject: memory leak found by coverity; Jim Razmus --- sbin/dump/itime.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sbin/dump/itime.c') diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index 2241697b0c3..5f56537495a 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: itime.c,v 1.13 2007/03/04 22:36:54 deraadt Exp $ */ +/* $OpenBSD: itime.c,v 1.14 2007/03/04 22:37:18 deraadt Exp $ */ /* $NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93"; #else -static const char rcsid[] = "$OpenBSD: itime.c,v 1.13 2007/03/04 22:36:54 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: itime.c,v 1.14 2007/03/04 22:37:18 deraadt Exp $"; #endif #endif /* not lint */ @@ -104,8 +104,10 @@ readdumptimes(FILE *df) for (;;) { dtwalk = (struct dumptime *)calloc(1, sizeof(struct dumptime)); - if (getrecord(df, &(dtwalk->dt_value)) < 0) + if (getrecord(df, &(dtwalk->dt_value)) < 0) { + free(dtwalk); break; + } nddates++; dtwalk->dt_next = dthead; dthead = dtwalk; -- cgit v1.2.3