diff options
author | brueffer <brueffer@FreeBSD.org> | 2011-08-27 15:28:57 +0000 |
---|---|---|
committer | brueffer <brueffer@FreeBSD.org> | 2011-08-27 15:28:57 +0000 |
commit | b95e8ce3cf932ea596e69b6d6a2f9a8278114f13 (patch) | |
tree | cfb5f8cd39ff7488b27fbfb054f1bfa5b3b2c678 /bin | |
parent | 55dd870b96d9c6061c2eff00ceaddd2a509b4919 (diff) | |
download | FreeBSD-src-b95e8ce3cf932ea596e69b6d6a2f9a8278114f13.zip FreeBSD-src-b95e8ce3cf932ea596e69b6d6a2f9a8278114f13.tar.gz |
Fix memory leaks in error cases.
PR: 159011
Submitted by: Henning Petersen <henning.petersen@t-online.de>
Approved by: re (kib)
MFC after: 1 week
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ed/buf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c index db1f0e9..b4b78a5 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -94,6 +94,7 @@ put_sbuf_line(const char *cs) ; if (s - cs >= LINECHARS) { errmsg = "line too long"; + free(lp); return NULL; } len = s - cs; @@ -102,6 +103,7 @@ put_sbuf_line(const char *cs) if (fseeko(sfp, (off_t)0, SEEK_END) < 0) { fprintf(stderr, "%s\n", strerror(errno)); errmsg = "cannot seek temp file"; + free(lp); return NULL; } sfseek = ftello(sfp); @@ -112,6 +114,7 @@ put_sbuf_line(const char *cs) sfseek = -1; fprintf(stderr, "%s\n", strerror(errno)); errmsg = "cannot write temp file"; + free(lp); return NULL; } lp->len = len; |