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_AssignedGroupIdentityProvider.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_AssignedGroupIdentityProvider.c')
-rw-r--r-- | src/account/LMI_AssignedGroupIdentityProvider.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/account/LMI_AssignedGroupIdentityProvider.c b/src/account/LMI_AssignedGroupIdentityProvider.c index a9037f1..c474bf9 100644 --- a/src/account/LMI_AssignedGroupIdentityProvider.c +++ b/src/account/LMI_AssignedGroupIdentityProvider.c @@ -80,7 +80,6 @@ static CMPIStatus LMI_AssignedGroupIdentityEnumInstances( fprintf(stderr, "Error initializing: %s\n", lu_strerror(error)); exit(1); } - gid = malloc(256 * sizeof(char)); groups = lu_groups_enumerate_full(luc, "*", &error); for (i = 0; (groups != NULL) && (i < groups->len); i++) { @@ -91,9 +90,9 @@ static CMPIStatus LMI_AssignedGroupIdentityEnumInstances( LMI_GroupRef_Set_Name(&lgref, aux_lu_get_str(lue, LU_GROUPNAME)); LMI_IdentityRef_Init(&liref, _cb, nameSpace); - snprintf(gid, 255, ORGID":GID:%ld", - aux_lu_get_long(lue, LU_GIDNUMBER)); + asprintf(&gid, ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER)); LMI_IdentityRef_Set_InstanceID(&liref, gid); + free(gid); LMI_AssignedGroupIdentity_Init(&lagi, _cb, nameSpace); LMI_AssignedGroupIdentity_Set_IdentityInfo(&lagi, &liref); @@ -102,7 +101,6 @@ static CMPIStatus LMI_AssignedGroupIdentityEnumInstances( KReturnInstance(cr, lagi); lu_ent_free(lue); } /* for */ - free(gid); CMReturn(CMPI_RC_OK); } |