changeset 13738:e10d315d1821

2801 svc.startd leaks significant amount of memory 2891 After integration of OS-1168 svc.startd has no umem debugging in debug build Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Theo Schlossnagle <jesus@omniti.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Milan Jurik <milan.jurik@xylab.cz>
date Wed, 20 Jun 2012 14:16:36 -0500
parents 1189735fe286
children f6a4c9dc9b80
files usr/src/cmd/svc/startd/Makefile usr/src/cmd/svc/startd/libscf.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/svc/startd/Makefile	Tue Jun 19 16:29:20 2012 -0500
+++ b/usr/src/cmd/svc/startd/Makefile	Wed Jun 20 14:16:36 2012 -0500
@@ -20,6 +20,7 @@
 #
 #
 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012 Milan Jurik. All rights reserved.
 #
 
 PROG = svc.startd
@@ -61,6 +62,7 @@
 
 ROOTCMDDIR=	$(ROOT)/lib/svc/bin
 
+$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
 CFLAGS += -v
 CPPFLAGS += -I. -I../common
 
--- a/usr/src/cmd/svc/startd/libscf.c	Tue Jun 19 16:29:20 2012 -0500
+++ b/usr/src/cmd/svc/startd/libscf.c	Wed Jun 20 14:16:36 2012 -0500
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012 Milan Jurik. All rights reserved.
  */
 
 
@@ -1850,6 +1851,7 @@
 	val = safe_scf_value_create(scf_property_handle(prop));
 
 	if (scf_property_get_value(prop, val) != 0) {
+		scf_value_destroy(val);
 		switch (scf_error()) {
 		case SCF_ERROR_CONNECTION_BROKEN:
 			return (ECONNABORTED);
@@ -1875,12 +1877,15 @@
 	}
 
 	if (scf_value_get_astring(val, buf, sizeof (buf)) < 0) {
+		scf_value_destroy(val);
 		if (scf_error() != SCF_ERROR_TYPE_MISMATCH)
 			bad_error("scf_value_get_astring", scf_error());
 
 		return (EINVAL);
 	}
 
+	scf_value_destroy(val);
+
 	if (buf[0] == '\0' || buf[1] != '\0')
 		return (EINVAL);