Address a potential memory leak found a the clang static code analyzer

running on the userland stack.

MFC after:	3 days
This commit is contained in:
Michael Tuexen 2016-07-16 07:48:01 +00:00
parent a5c6318fc3
commit 56d2f7d8e5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302928

View File

@ -542,7 +542,7 @@ sctp_insert_sharedkey(struct sctp_keyhead *shared_keys,
}
}
/* shouldn't reach here */
return (0);
return (EINVAL);
}
void
@ -622,8 +622,11 @@ sctp_copy_skeylist(const struct sctp_keyhead *src, struct sctp_keyhead *dest)
LIST_FOREACH(skey, src, next) {
new_skey = sctp_copy_sharedkey(skey);
if (new_skey != NULL) {
(void)sctp_insert_sharedkey(dest, new_skey);
count++;
if (sctp_insert_sharedkey(dest, new_skey)) {
sctp_free_sharedkey(new_skey);
} else {
count++;
}
}
}
return (count);