Bug #2742 ยป 2742.diff
new/usr/src/cmd/svc/svccfg/svccfg_libscf.c Sun May 27 16:50:27 2012 | ||
---|---|---|
21 | 21 | |
22 | 22 |
/* |
23 | 23 |
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. |
24 |
* Copyright 2012 Milan Jurik. All rights reserved. |
|
24 | 25 |
*/ |
25 | 26 | |
26 | 27 | |
... | ... | |
3900 | 3901 |
pgroup_t *mfst_pgroup; |
3901 | 3902 |
property_t *mfst_prop; |
3902 | 3903 |
property_t *old_prop; |
3903 |
char *pname = malloc(MAXPATHLEN);
|
|
3904 |
char *fval = NULL;
|
|
3904 |
char *pname; |
|
3905 |
char *fval; |
|
3905 | 3906 |
char *old_pname; |
3906 | 3907 |
char *old_fval; |
3907 | 3908 |
int no_upgrade_pg; |
... | ... | |
3971 | 3972 |
SCF_SUCCESS) |
3972 | 3973 |
return (-1); |
3973 | 3974 | |
3975 |
if ((pname = malloc(MAXPATHLEN)) == NULL) |
|
3976 |
return (ENOMEM); |
|
3977 |
if ((fval = malloc(MAXPATHLEN)) == NULL) { |
|
3978 |
free(pname); |
|
3979 |
return (ENOMEM); |
|
3980 |
} |
|
3981 | ||
3974 | 3982 |
while ((r = scf_iter_next_property(ud_prop_iter, ud_prop)) == 1) { |
3975 | 3983 |
mfst_seen = 0; |
3976 | 3984 |
if (scf_property_get_name(ud_prop, pname, MAXPATHLEN) < 0) |
... | ... | |
3990 | 3998 |
* property list to get proccessed into the repo. |
3991 | 3999 |
*/ |
3992 | 4000 |
if (mfst_seen == 0) { |
3993 |
if (fval == NULL) |
|
3994 |
fval = malloc(MAXPATHLEN); |
|
3995 | ||
3996 | 4001 |
/* |
3997 | 4002 |
* If we cannot get the value then there is no |
3998 | 4003 |
* reason to attempt to attach the value to |
3999 | 4004 |
* the property group |
4000 | 4005 |
*/ |
4001 |
if (fval != NULL && |
|
4002 |
prop_get_val(ud_prop, fname_value) == 0 && |
|
4006 |
if (prop_get_val(ud_prop, fname_value) == 0 && |
|
4003 | 4007 |
scf_value_get_astring(fname_value, fval, |
4004 | 4008 |
MAXPATHLEN) != -1) { |
4005 | 4009 |
old_pname = safe_strdup(pname); |
... | ... | |
4016 | 4020 |
} |
4017 | 4021 |
} |
4018 | 4022 |
} |
4023 |
free(pname); |
|
4019 | 4024 |
free(fval); |
4020 | 4025 | |
4021 | 4026 |
cbdata.sc_handle = g_hndl; |