Date: Mon, 16 Apr 2018 12:46:14 +0000 (UTC) From: Toomas Soome <tsoome@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332560 - head/stand/common Message-ID: <201804161246.w3GCkEZA087199@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804161246.w3GCkEZA087199>