From owner-svn-src-stable-7@FreeBSD.ORG Sat Sep 3 21:28:26 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1FA4106566C; Sat, 3 Sep 2011 21:28:26 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E140F8FC13; Sat, 3 Sep 2011 21:28:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p83LSQT0062539; Sat, 3 Sep 2011 21:28:26 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p83LSQqG062537; Sat, 3 Sep 2011 21:28:26 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109032128.p83LSQqG062537@svn.freebsd.org> From: Christian Brueffer Date: Sat, 3 Sep 2011 21:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225370 - stable/7/bin/ed X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 21:28:27 -0000 Author: brueffer Date: Sat Sep 3 21:28:26 2011 New Revision: 225370 URL: http://svn.freebsd.org/changeset/base/225370 Log: MFC: r225215 Fix memory leak in error cases. Modified: stable/7/bin/ed/buf.c Directory Properties: stable/7/bin/ed/ (props changed) Modified: stable/7/bin/ed/buf.c ============================================================================== --- stable/7/bin/ed/buf.c Sat Sep 3 20:46:30 2011 (r225369) +++ stable/7/bin/ed/buf.c Sat Sep 3 21:28:26 2011 (r225370) @@ -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;