diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2013-11-04 14:54:50 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2013-11-04 15:11:38 +0100 |
commit | 834582da22be09cf318d988c18e20f73d766116f (patch) | |
tree | 025d72bdbbc11360040ac706f80067fd5560d4bd | |
parent | 1cc65739b1ce02e2565813bf70716a7e9de277ec (diff) | |
download | openlmi-providers-834582da22be09cf318d988c18e20f73d766116f.tar.gz openlmi-providers-834582da22be09cf318d988c18e20f73d766116f.tar.xz openlmi-providers-834582da22be09cf318d988c18e20f73d766116f.zip |
account: Fix libuser object cleanup
Potential double free or freeing of uninitialized memory. Fixes some
asserts thrown from libuser.
-rw-r--r-- | src/account/LMI_GroupProvider.c | 7 | ||||
-rw-r--r-- | src/account/LMI_MemberOfGroupProvider.c | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/account/LMI_GroupProvider.c b/src/account/LMI_GroupProvider.c index c19646d..b147586 100644 --- a/src/account/LMI_GroupProvider.c +++ b/src/account/LMI_GroupProvider.c @@ -187,7 +187,6 @@ static CMPIrc delete_group( "Cannot delete group %s, it is primary group of user %s\n", groupname, username); rc = GROUP_IS_PRIMARY; - lu_ent_free(lueu); goto clean; } lu_ent_free(lueu); @@ -201,8 +200,10 @@ static CMPIrc delete_group( } clean: - lu_ent_free(lueg); - lu_ent_free(lueu); + if (lueg) + lu_ent_free(lueg); + if (lueu) + lu_ent_free(lueu); lu_end(luc); return rc; } diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c index 1751e41..511833a 100644 --- a/src/account/LMI_MemberOfGroupProvider.c +++ b/src/account/LMI_MemberOfGroupProvider.c @@ -285,7 +285,6 @@ static CMPIStatus LMI_MemberOfGroupDeleteInstance( struct lu_ent *lue_u = lu_ent_new(); if (!lu_user_lookup_id(luc, user_id, lue_u, &error)) { - lu_end(luc); asprintf(&errmsg, "User with id %d not found: %s\n", user_id, lu_strerror(error)); rc = CMPI_RC_ERR_FAILED; |