Print this page
2831 svc.startd and svc.configd waste memory.
*** 19,28 ****
--- 19,29 ----
* CDDL HEADER END
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <libintl.h>
#include <librestart.h>
#include <librestart_priv.h>
*** 3331,3340 ****
--- 3332,3345 ----
* A method_context was not used for any configurable
* elements or attributes, so reset and use the simple
* defaults that provide historic init behavior.
*/
if (mc_used == 0) {
+ free(cip->pwbuf);
+ free(cip->vbuf);
+ free(cip->working_dir);
+
(void) memset(cip, 0, sizeof (*cip));
cip->uid = 0;
cip->gid = 0;
cip->euid = (uid_t)-1;
cip->egid = (gid_t)-1;
*** 3346,3357 ****
(void) scf_value_destroy(val);
scf_property_destroy(prop);
scf_pg_destroy(instpg);
scf_pg_destroy(methpg);
! if (cip->pwbuf != NULL)
free(cip->pwbuf);
free(cip->vbuf);
if (err->type != 0) {
restarter_free_method_context(cip);
} else {
--- 3351,3365 ----
(void) scf_value_destroy(val);
scf_property_destroy(prop);
scf_pg_destroy(instpg);
scf_pg_destroy(methpg);
! if (cip->pwbuf != NULL) {
free(cip->pwbuf);
+ cip->pwbuf = NULL;
+ }
+
free(cip->vbuf);
if (err->type != 0) {
restarter_free_method_context(cip);
} else {