summaryrefslogtreecommitdiff
path: root/sbin/dump/itime.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-04 22:37:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-04 22:37:19 +0000
commita382cfbd0d0878926dd5eb700cc22d4ba7b6d80f (patch)
tree29df0cbeba59b2f711aa451c0fdf1a05a1c2ab62 /sbin/dump/itime.c
parentb596b394d9d55141e5d041915f69d33a3f01f668 (diff)
memory leak found by coverity; Jim Razmus
Diffstat (limited to 'sbin/dump/itime.c')
-rw-r--r--sbin/dump/itime.c8
1 files changed, 5 insertions, 3 deletions
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;