Date: Sat, 3 Sep 2011 20:46:30 +0000 (UTC) From: Christian Brueffer <brueffer@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r225369 - stable/8/bin/ed Message-ID: <201109032046.p83KkUGO061252@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brueffer Date: Sat Sep 3 20:46:30 2011 New Revision: 225369 URL: http://svn.freebsd.org/changeset/base/225369 Log: MFC: r225215 Fix memory leaks in error cases. Modified: stable/8/bin/ed/buf.c Directory Properties: stable/8/bin/ed/ (props changed) Modified: stable/8/bin/ed/buf.c ============================================================================== --- stable/8/bin/ed/buf.c Sat Sep 3 15:34:18 2011 (r225368) +++ stable/8/bin/ed/buf.c Sat Sep 3 20:46:30 2011 (r225369) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109032046.p83KkUGO061252>