mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix use-after-free
This commit is contained in:
21
src/dbus.c
21
src/dbus.c
@@ -91,16 +91,19 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data)
|
|||||||
|
|
||||||
static void remove_watch(DBusWatch *watch, void *data)
|
static void remove_watch(DBusWatch *watch, void *data)
|
||||||
{
|
{
|
||||||
struct watch **up, *w;
|
struct watch **up, *w, *tmp;
|
||||||
|
|
||||||
for (up = &(daemon->watches), w = daemon->watches; w; w = w->next)
|
for (up = &(daemon->watches), w = daemon->watches; w; w = tmp)
|
||||||
if (w->watch == watch)
|
{
|
||||||
{
|
tmp = w->next;
|
||||||
*up = w->next;
|
if (w->watch == watch)
|
||||||
free(w);
|
{
|
||||||
}
|
*up = tmp;
|
||||||
else
|
free(w);
|
||||||
up = &(w->next);
|
}
|
||||||
|
else
|
||||||
|
up = &(w->next);
|
||||||
|
}
|
||||||
|
|
||||||
w = data; /* no warning */
|
w = data; /* no warning */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user