svn commit: r361941 - stable/12/sbin/dhclient
Mark Johnston
markj at FreeBSD.org
Mon Jun 8 21:35:25 UTC 2020
Author: markj
Date: Mon Jun 8 21:35:24 2020
New Revision: 361941
URL: https://svnweb.freebsd.org/changeset/base/361941
Log:
MFC r361793:
dhclient: Fix a logic bug remove_protocol().
PR: 245971
Modified:
stable/12/sbin/dhclient/dispatch.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sbin/dhclient/dispatch.c
==============================================================================
--- stable/12/sbin/dhclient/dispatch.c Mon Jun 8 21:11:34 2020 (r361940)
+++ stable/12/sbin/dhclient/dispatch.c Mon Jun 8 21:35:24 2020 (r361941)
@@ -474,13 +474,16 @@ add_protocol(const char *name, int fd, void (*handler)
void
remove_protocol(struct protocol *proto)
{
- struct protocol *p, *next;
+ struct protocol *p, *prev;
- for (p = protocols; p; p = next) {
- next = p->next;
+ for (p = protocols, prev = NULL; p != NULL; prev = p, p = p->next) {
if (p == proto) {
- protocols = p->next;
+ if (prev == NULL)
+ protocols = p->next;
+ else
+ prev->next = p->next;
free(p);
+ break;
}
}
}
More information about the svn-src-stable-12
mailing list