mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 04:04:09 +00:00
Fix the "Use-after-free" of clang SA.
- Set the pointer to NULL after free it, otherwise the pointer will be accessed again. (since not null) Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
This commit is contained in:
parent
d8d58e9839
commit
5d6cc38ca3
@ -209,8 +209,10 @@ msgbuf_clear(struct msgbuf *msgbuf)
|
||||
{
|
||||
struct ibuf *buf;
|
||||
|
||||
while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL)
|
||||
while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) {
|
||||
ibuf_dequeue(msgbuf, buf);
|
||||
TAILQ_FIRST(&msgbuf->bufs) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -310,6 +310,7 @@ imsg_get_fd(struct imsgbuf *ibuf)
|
||||
fd = ifd->fd;
|
||||
TAILQ_REMOVE(&ibuf->fds, ifd, entry);
|
||||
free(ifd);
|
||||
TAILQ_FIRST(&ibuf->fds) = NULL;
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user