net: lib: tls_credentials_shell: Fix crash during delete
Deletion of credential should use the pointer from the reference slot not the temporary buffer, this causes a crash (unknown error). Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
parent
31913efcbf
commit
c2f4e67c8a
1 changed files with 2 additions and 2 deletions
|
@ -564,8 +564,8 @@ static int tls_cred_cmd_del(const struct shell *sh, size_t argc, char *argv[])
|
|||
ref_slot = cred->buf != NULL ? find_ref_slot(cred->buf) : -1;
|
||||
if (ref_slot >= 0) {
|
||||
/* This was a credential we copied to heap. Clear and free it. */
|
||||
memset((void *)cred_buf, 0, cred->len);
|
||||
k_free((void *)cred_buf);
|
||||
memset(&cred_refs[ref_slot], 0, cred->len);
|
||||
k_free((void *)cred_refs[ref_slot]);
|
||||
cred->buf = NULL;
|
||||
|
||||
/* Clear the reference slot so it can be used again. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue