diff options
author | Roman Rakus <rrakus@redhat.com> | 2013-06-12 15:48:43 +0200 |
---|---|---|
committer | Roman Rakus <rrakus@redhat.com> | 2013-06-12 15:51:11 +0200 |
commit | 7057f8c9ed6f51044a853710defde4ef14f2a340 (patch) | |
tree | d712bc7682fcf677c6d473047caf7fd78dd7f8b7 /src/account/LMI_ServiceAffectsIdentityProvider.c | |
parent | ec58653e83ba32cba3a3f51d9fcedca4873c7ab7 (diff) | |
download | openlmi-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_ServiceAffectsIdentityProvider.c')
-rw-r--r-- | src/account/LMI_ServiceAffectsIdentityProvider.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/account/LMI_ServiceAffectsIdentityProvider.c b/src/account/LMI_ServiceAffectsIdentityProvider.c index 64e218b..6155010 100644 --- a/src/account/LMI_ServiceAffectsIdentityProvider.c +++ b/src/account/LMI_ServiceAffectsIdentityProvider.c @@ -90,7 +90,6 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances( exit(1); } - id = malloc(256 * sizeof(char)); /* Go through every accounts first */ accounts = lu_users_enumerate_full(luc, "*", &error); @@ -99,9 +98,9 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances( lue = g_ptr_array_index(accounts, i); LMI_IdentityRef_Init(&liref, _cb, nameSpace); - snprintf(id, 255, ORGID":UID:%ld", - aux_lu_get_long(lue, LU_UIDNUMBER)); + asprintf(&id, ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER)); LMI_IdentityRef_Set_InstanceID(&liref, id); + free(id); LMI_ServiceAffectsIdentity_Init(&lsai, _cb, nameSpace); LMI_ServiceAffectsIdentity_Set_AffectedElement(&lsai, &liref); @@ -126,9 +125,9 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances( lue = g_ptr_array_index(accounts, i); LMI_IdentityRef_Init(&liref, _cb, nameSpace); - snprintf(id, 255, ORGID":GID:%ld", - aux_lu_get_long(lue, LU_GIDNUMBER)); + asprintf(&id, ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER)); LMI_IdentityRef_Set_InstanceID(&liref, id); + free(id); LMI_ServiceAffectsIdentity_Init(&lsai, _cb, nameSpace); LMI_ServiceAffectsIdentity_Set_AffectedElement(&lsai, &liref); @@ -147,7 +146,6 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances( g_ptr_array_free(accounts, TRUE); } - free(id); lu_end(luc); CMReturn(CMPI_RC_OK); |