Module Name: src Committed By: msaitoh Date: Sun Aug 18 13:32:50 UTC 2019
Modified Files: src/usr.sbin/sysinst [netbsd-9]: checkrc.c Log Message: Pull up following revision(s) (requested by martin in ticket #89): usr.sbin/sysinst/checkrc.c: revision 1.2 Fix memory leak (found by MKSANITIZER=yes build). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.30.1 src/usr.sbin/sysinst/checkrc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/sysinst/checkrc.c diff -u src/usr.sbin/sysinst/checkrc.c:1.1 src/usr.sbin/sysinst/checkrc.c:1.1.30.1 --- src/usr.sbin/sysinst/checkrc.c:1.1 Sat Jul 26 19:30:44 2014 +++ src/usr.sbin/sysinst/checkrc.c Sun Aug 18 13:32:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: checkrc.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ +/* $NetBSD: checkrc.c,v 1.1.30.1 2019/08/18 13:32:50 msaitoh Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -81,6 +81,7 @@ static int check(const char *varname, int filetocheck) { char *buf; + int rv; create_script(varname, filetocheck); @@ -98,10 +99,9 @@ check(const char *varname, int filetoche fflush(logfp); } - if (strncmp(buf, "YES", strlen("YES")) == 0) - return 1; - else - return 0; + rv = strncmp(buf, "YES", strlen("YES")) == 0; + free(buf); + return rv; } int