Skip to content

Commit

Permalink
KCM: another memory leak fixed
Browse files Browse the repository at this point in the history
```
...
    talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains      0 bytes in   1 blocks (ref 0) 0x563feaabc0a0
    talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains      0 bytes in   1 blocks (ref 0) 0x563feaa84f90
    talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains      0 bytes in   1 blocks (ref 0) 0x563feaabf520
...
```

Reviewed-by: Alejandro López <[email protected]>
(cherry picked from commit 9e72bc2)
  • Loading branch information
alexey-tikhonov committed Feb 12, 2025
1 parent c6d7ba0 commit f4858c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/responder/kcm/kcmsrv_ccache.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx,

tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
goto done;
goto fail;
}

for (cred = kcm_cc_get_cred(cc); cred != NULL; cred = kcm_cc_next_cred(cred)) {
Expand All @@ -420,7 +420,7 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx,
cred_list[i] = kcm_cred_to_krb5(krb_context, cred);
if (cred_list[i] == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Failed to convert kcm cred to krb5\n");
goto done;
goto fail;
}
}

Expand All @@ -429,8 +429,10 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx,

talloc_steal(mem_ctx, cred_list);

talloc_free(tmp_ctx);
return cred_list;
done:

fail:
talloc_free(tmp_ctx);
return NULL;
#endif
Expand Down

0 comments on commit f4858c7

Please sign in to comment.