diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-03-31 11:21:06 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-03-31 11:23:48 (GMT) |
commit | 34bfce62150d07cf9894f2d9cbd0c989a203ea52 (patch) | |
tree | d4be18fc563f1aa9692a1c56deb04397ce72cc3a | |
parent | baa2cadd02086a053eb140c91d7f0681112ac370 (diff) | |
download | libnl-34bfce62150d07cf9894f2d9cbd0c989a203ea52.zip libnl-34bfce62150d07cf9894f2d9cbd0c989a203ea52.tar.gz libnl-34bfce62150d07cf9894f2d9cbd0c989a203ea52.tar.bz2 |
link: Catch missing io_free() implementations
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | include/netlink-private/netlink.h | 7 | ||||
-rw-r--r-- | lib/route/link.c | 4 |
2 files changed, 11 insertions, 0 deletions
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; } |