Author: des Date: Thu Oct 23 22:42:56 2014 New Revision: 273564 URL: https://svnweb.freebsd.org/changeset/base/273564
Log: In all cases except CTLTYPE_STRING, penv is NULL here, so passing it indiscriminately to printf() and freeenv() is incorrect. Add a NULL check before freeenv(); as for printf(), we could use req.newptr instead, but we'd have to select the correct format string based on the type, and that's too much work for an error message, so just remove it. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Oct 23 22:33:27 2014 (r273563) +++ head/sys/kern/kern_sysctl.c Thu Oct 23 22:42:56 2014 (r273564) @@ -280,11 +280,10 @@ sysctl_load_tunable_by_oid_locked(struct } error = sysctl_root_handler_locked(oidp, oidp->oid_arg1, oidp->oid_arg2, &req); - if (error != 0) { - printf("Setting sysctl '%s' to '%s' failed: %d\n", - path, penv, error); - } - freeenv(penv); + if (error != 0) + printf("Setting sysctl %s failed: %d\n", path, error); + if (penv != NULL) + freeenv(penv); } void _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"