summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-04-22 04:27:38 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-04-22 04:27:38 +0000
commitf8250380da4b40c03b6bf7b09e5b18d747e9bb30 (patch)
tree7eec90246f89026d512be142b9f2353a287f664c /usr.bin/mg
parent78a43022b547d717568e958139aa705d1d7a5be0 (diff)
fix mem leak
ok deraadt@
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/fileio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 82eda688980..cfe1eddea57 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.28 2002/04/15 23:24:42 deraadt Exp $ */
+/* $OpenBSD: fileio.c,v 1.29 2002/04/22 04:27:37 vincent Exp $ */
/*
* POSIX fileio.c
@@ -174,6 +174,7 @@ fbackupfile(const char *fn)
}
if (stat(fn, &sb) == -1) {
ewprintf("Can't stat %s : %s", fn, strerror(errno));
+ free(nname);
return (FALSE);
}
@@ -191,8 +192,8 @@ fbackupfile(const char *fn)
}
while ((nread = read(from, buf, sizeof(buf))) > 0) {
if (write(to, buf, nread) != nread) {
- nread = -1;
- break;
+ nread = -1;
+ break;
}
}
serrno = errno;