Drop entries cached for interface we're going to delete
authorRafał Miłecki <rafal@milecki.pl>
Mon, 20 Mar 2017 11:54:50 +0000 (12:54 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 20 Mar 2017 12:31:25 +0000 (13:31 +0100)
Since we free memory with struct interface we can't keep
referencing/using it in cached records or services.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
interface.c

index a09e7ce093a54f51d99bcadbeb3ae2c44a7df4a8..cde184bec9b3cc25147c17db327e41f3665b3e79 100644 (file)
@@ -34,6 +34,7 @@
 #include <libubox/uloop.h>
 #include <libubox/avl-cmp.h>
 #include <libubox/utils.h>
+#include "cache.h"
 #include "interface.h"
 #include "util.h"
 #include "dns.h"
@@ -519,6 +520,7 @@ iface_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
 
        if (node_old) {
                iface = container_of(node_old, struct interface, node);
+               cache_cleanup(iface);
                interface_free(iface);
        }