diff --git a/include/netlink-private/netlink.h b/include/netlink-private/netlink.h index ee2a8b1..e366d1e 100644 --- a/include/netlink-private/netlink.h +++ b/include/netlink-private/netlink.h @@ -102,6 +102,13 @@ struct trans_list { assert(0); \ } while (0) +#define BUG_ON(condition) \ + do { \ + if (condition) \ + BUG(); \ + } while (0) + + #define APPBUG(msg) \ do { \ fprintf(stderr, "APPLICATION BUG: %s:%d:%s: %s\n", \ diff --git a/lib/route/link.c b/lib/route/link.c index d609b17..3263096 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -194,6 +194,10 @@ static void release_link_info(struct rtnl_link *link) if (io != NULL) { if (io->io_free) io->io_free(link); + else { + /* Catch missing io_free() implementations */ + BUG_ON(link->l_info); + } rtnl_link_info_ops_put(io); link->l_info_ops = NULL; }