summaryrefslogtreecommitdiffstats
path: root/src/account/LMI_MemberOfGroupProvider.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_MemberOfGroupProvider.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_MemberOfGroupProvider.c')
-rw-r--r--src/account/LMI_MemberOfGroupProvider.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c
index 06f835c..beb5edd 100644
--- a/src/account/LMI_MemberOfGroupProvider.c
+++ b/src/account/LMI_MemberOfGroupProvider.c
@@ -83,7 +83,6 @@ static CMPIStatus LMI_MemberOfGroupEnumInstances(
fprintf(stderr, "Error initializing: %s\n", lu_strerror(error));
exit(1);
}
- uid = malloc(256 * sizeof(char));
/* Go through each group */
groups = lu_groups_enumerate_full(luc, "*", &error);
for (i = 0; (groups != NULL) && (i < groups->len); i++)
@@ -102,10 +101,11 @@ static CMPIStatus LMI_MemberOfGroupEnumInstances(
lu_user_lookup_name(luc,
g_value_get_string(g_value_array_get_nth(accounts, j)),
luea, &error);
- snprintf(uid, 255, ORGID":UID:%ld",
+ asprintf(&uid, ORGID":UID:%ld",
aux_lu_get_long(luea, LU_UIDNUMBER));
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
LMI_IdentityRef_Set_InstanceID(&liref, uid);
+ free(uid);
LMI_MemberOfGroup_Init(&lmog, _cb, nameSpace);
LMI_MemberOfGroup_Set_Collection(&lmog, &lgref);
@@ -122,7 +122,6 @@ static CMPIStatus LMI_MemberOfGroupEnumInstances(
lu_ent_free(lueg);
} /* for groups */
- free(uid);
if (groups)
{