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_AssignedAccountIdentityProvider.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_AssignedAccountIdentityProvider.c')
-rw-r--r-- | src/account/LMI_AssignedAccountIdentityProvider.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/account/LMI_AssignedAccountIdentityProvider.c b/src/account/LMI_AssignedAccountIdentityProvider.c index 323a582..72f5d1e 100644 --- a/src/account/LMI_AssignedAccountIdentityProvider.c +++ b/src/account/LMI_AssignedAccountIdentityProvider.c @@ -81,16 +81,15 @@ static CMPIStatus LMI_AssignedAccountIdentityEnumInstances( fprintf(stderr, "Error initializing: %s\n", lu_strerror(error)); exit(1); } - uid = malloc(256 * sizeof(char)); accounts = lu_users_enumerate_full(luc, "*", &error); for (i = 0; (accounts != NULL) && (i < accounts->len); i++) { lue = g_ptr_array_index(accounts, i); LMI_IdentityRef_Init(&liref, _cb, nameSpace); - snprintf(uid, 255, ORGID":UID:%ld", - aux_lu_get_long(lue, LU_UIDNUMBER)); + asprintf(&uid, ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER)); LMI_IdentityRef_Set_InstanceID(&liref, uid); + free(uid); LMI_AccountRef_Init(&laref, _cb, nameSpace); LMI_AccountRef_Set_Name(&laref, aux_lu_get_str(lue, LU_USERNAME)); @@ -105,7 +104,6 @@ static CMPIStatus LMI_AssignedAccountIdentityEnumInstances( KReturnInstance(cr, laai); lu_ent_free(lue); } /* for */ - free(uid); if (accounts) { |