From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 3 20:46:30 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999BA106566C; Sat, 3 Sep 2011 20:46:30 +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 88EEF8FC14; Sat, 3 Sep 2011 20:46:30 +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 p83KkUd7061254; Sat, 3 Sep 2011 20:46:30 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p83KkUGO061252; Sat, 3 Sep 2011 20:46:30 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109032046.p83KkUGO061252@svn.freebsd.org> From: Christian Brueffer Date: Sat, 3 Sep 2011 20:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225369 - stable/8/bin/ed X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 20:46:30 -0000 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;