]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
link: Catch missing io_free() implementations
authorThomas Graf <tgraf@suug.ch>
Mon, 31 Mar 2014 11:21:06 +0000 (13:21 +0200)
committerThomas Haller <thaller@redhat.com>
Mon, 31 Mar 2014 11:23:48 +0000 (13:23 +0200)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
include/netlink-private/netlink.h
lib/route/link.c

index ee2a8b10af5382b83dc264ab209b77e16573f7cf..e366d1e90f8985445359f8b7a3292ef740b3a6f5 100644 (file)
@@ -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",      \
index d609b176427442bc1f8acb0710d3ab42ad130358..3263096e33f75ac07447f1bc1a2b96fff92e066a 100644 (file)
@@ -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;
        }