summaryrefslogtreecommitdiffstats
path: root/src/account/LMI_GroupProvider.c
diff options
context:
space:
mode:
authorRoman Rakus <rrakus@redhat.com>2013-06-12 15:48:43 +0200
committerRoman Rakus <rrakus@redhat.com>2013-06-12 15:51:11 +0200
commit7057f8c9ed6f51044a853710defde4ef14f2a340 (patch)
treed712bc7682fcf677c6d473047caf7fd78dd7f8b7 /src/account/LMI_GroupProvider.c
parentec58653e83ba32cba3a3f51d9fcedca4873c7ab7 (diff)
downloadopenlmi-providers-7057f8c9ed6f51044a853710defde4ef14f2a340.tar.gz
openlmi-providers-7057f8c9ed6f51044a853710defde4ef14f2a340.tar.xz
openlmi-providers-7057f8c9ed6f51044a853710defde4ef14f2a340.zip
Account: Use asprintf instead of snprintf
Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'src/account/LMI_GroupProvider.c')
-rw-r--r--src/account/LMI_GroupProvider.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/account/LMI_GroupProvider.c b/src/account/LMI_GroupProvider.c
index c9d8ebb..5356eac 100644
--- a/src/account/LMI_GroupProvider.c
+++ b/src/account/LMI_GroupProvider.c
@@ -75,7 +75,6 @@ static CMPIStatus LMI_GroupEnumInstances(
exit(1);
}
- instanceid = malloc(256 * sizeof(char));
groups = lu_groups_enumerate_full(luc, "*", &error);
for (i = 0; (groups != NULL) && (i < groups->len); i++)
{
@@ -86,13 +85,13 @@ static CMPIStatus LMI_GroupEnumInstances(
LMI_Group_Set_Name(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
LMI_Group_Set_ElementName(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
LMI_Group_Set_CommonName(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
- snprintf(instanceid, 255, ORGID":GID:%ld",
+ asprintf(&instanceid, ORGID":GID:%ld",
aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_Group_Set_InstanceID(&lg, instanceid);
+ free(instanceid);
KReturnInstance(cr, lg);
lu_ent_free(lue);
} /* for */
- free(instanceid);
if (groups)
{