From owner-svn-src-head@freebsd.org Mon Apr 16 12:46:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C97FF8044A; Mon, 16 Apr 2018 12:46:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C36F874C79; Mon, 16 Apr 2018 12:46:14 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDE8A1D73D; Mon, 16 Apr 2018 12:46:14 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3GCkETK087200; Mon, 16 Apr 2018 12:46:14 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3GCkEZA087199; Mon, 16 Apr 2018 12:46:14 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201804161246.w3GCkEZA087199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 16 Apr 2018 12:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332560 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 332560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 12:46:15 -0000 Author: tsoome Date: Mon Apr 16 12:46:14 2018 New Revision: 332560 URL: https://svnweb.freebsd.org/changeset/base/332560 Log: loader: make sure we do not return garbage from help_getnext Since we do free subtopic and desc in help_getnext(), we need to set them also NULL, so we make sure we dont get double free(). Approved by: bapt Differential Revision: https://reviews.freebsd.org/D15082 Modified: head/stand/common/commands.c Modified: head/stand/common/commands.c ============================================================================== --- head/stand/common/commands.c Mon Apr 16 09:17:36 2018 (r332559) +++ head/stand/common/commands.c Mon Apr 16 12:46:14 2018 (r332560) @@ -74,7 +74,6 @@ help_getnext(int fd, char **topic, char **subtopic, ch if ((strlen(line) < 3) || (line[0] != '#') || (line[1] != ' ')) continue; - *topic = *subtopic = *desc = NULL; cp = line + 2; while((cp != NULL) && (*cp != 0)) { ep = strchr(cp, ' '); @@ -95,6 +94,7 @@ help_getnext(int fd, char **topic, char **subtopic, ch if (*topic == NULL) { free(*subtopic); free(*desc); + *subtopic = *desc = NULL; continue; } return(1);