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_AccountProvider.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_AccountProvider.c')
-rw-r--r-- | src/account/LMI_AccountProvider.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c index ef7cbf7..a34593e 100644 --- a/src/account/LMI_AccountProvider.c +++ b/src/account/LMI_AccountProvider.c @@ -93,7 +93,6 @@ static CMPIStatus LMI_AccountEnumInstances( exit(1); } - uid = malloc(256 * sizeof(char)); accounts = lu_users_enumerate_full(luc, "*", &error); for (i = 0; (accounts != NULL) && (i < accounts->len); i++) { @@ -109,8 +108,9 @@ static CMPIStatus LMI_AccountEnumInstances( LMI_Account_Set_OrganizationName(&la, 0, ""); /* XXX */ /* Need to convert long int UID to the string */ - snprintf(uid, 255, "%ld", aux_lu_get_long(lue, LU_UIDNUMBER)); + asprintf(&uid, "%ld", aux_lu_get_long(lue, LU_UIDNUMBER)); LMI_Account_Set_UserID(&la, uid); + free(uid); LMI_Account_Init_Host(&la, 1); LMI_Account_Set_Host(&la, 0, hostname); @@ -184,7 +184,6 @@ static CMPIStatus LMI_AccountEnumInstances( KReturnInstance(cr, la); lu_ent_free(lue); } /* for */ - free(uid); if (accounts) { |