summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-08-07 22:13:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-08-07 22:13:44 +0000
commitd1f4c3de2439fc79b40d52a952a08984ac97b0ed (patch)
treee1e4a9e198bfe56b4c996ea9135e38234adb0fa0 /bin
parentb9d19973b2e03b5b65b632e69c8efba3f46ea68c (diff)
plug some obvious memory leaks; Patrick Latifi
Diffstat (limited to 'bin')
-rw-r--r--bin/ed/buf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c
index 22127697a42..2c01f54e68a 100644
--- a/bin/ed/buf.c
+++ b/bin/ed/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.14 2003/06/11 23:42:12 deraadt Exp $ */
+/* $OpenBSD: buf.c,v 1.15 2003/08/07 22:13:43 millert Exp $ */
/* $NetBSD: buf.c,v 1.15 1995/04/23 10:07:28 cgd Exp $ */
/* buf.c: This file contains the scratch-file buffer rountines for the
@@ -33,7 +33,7 @@
#if 0
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: buf.c,v 1.14 2003/06/11 23:42:12 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: buf.c,v 1.15 2003/08/07 22:13:43 millert Exp $";
#endif
#endif /* not lint */
@@ -102,6 +102,7 @@ put_sbuf_line(char *cs)
;
if (s - cs >= LINECHARS) {
seterrmsg("line too long");
+ free(lp);
return NULL;
}
len = s - cs;
@@ -110,6 +111,7 @@ put_sbuf_line(char *cs)
if (fseek(sfp, 0L, SEEK_END) < 0) {
perror(NULL);
seterrmsg("cannot seek temp file");
+ free(lp);
return NULL;
}
sfseek = ftell(sfp);
@@ -120,6 +122,7 @@ put_sbuf_line(char *cs)
sfseek = -1;
perror(NULL);
seterrmsg("cannot write temp file");
+ free(lp);
return NULL;
}
lp->len = len;