[ovs-dev] [PATCH] route-table: Fix memory leak reported by valgrind.

Ben Pfaff blp at ovn.org
Tue Jul 5 15:35:02 UTC 2016


On Tue, Jul 05, 2016 at 07:30:11AM -0700, William Tu wrote:
> Hi Ben,
> 
> Thanks, this indeed fixes the "possible" leaks.

Thanks, I applied this to master as follows.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at ovn.org>
Date: Tue, 5 Jul 2016 08:33:05 -0700
Subject: [PATCH] netlink-notifier: Avoid valgrind possible leak warning.

This ensures that pointers to nln_notifiers are to the beginning of the
structs instead of to the middle, meaning that valgrind does not consider
them "possible" leaks.

Reported-by: William Tu <u9012063 at gmail.com>
Tested-by: William Tu <u9012063 at gmail.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/netlink-notifier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index 0867952..3acded4 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2016 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,9 +46,9 @@ struct nln {
 };
 
 struct nln_notifier {
+    struct ovs_list node;        /* In struct nln's 'all_notifiers' list. */
     struct nln *nln;             /* Parent nln. */
 
-    struct ovs_list node;
     int multicast_group;         /* Multicast group we listen on. */
     nln_notify_func *cb;
     void *aux;
-- 
2.1.3




More information about the dev mailing list