[ovs-dev] [coverity 02/14] leak-checker: Fix warning about use after free in hook_free().

Justin Pettit jpettit at nicira.com
Tue Feb 22 01:44:45 UTC 2011


Coverity complains of a use after free error in hook_free().  Since this
is only printing the pointer address it should be fine, but at the very
least it looks odd.

Coverity #11069
---
 lib/leak-checker.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/leak-checker.c b/lib/leak-checker.c
index 8b78182..a88da47 100644
--- a/lib/leak-checker.c
+++ b/lib/leak-checker.c
@@ -216,10 +216,10 @@ hook_free(void *p, const void *caller OVS_UNUSED)
     }
 
     set_hooks(&libc_hooks);
-    free(p);
     get_hooks(&libc_hooks);
 
     log_callers("free(%p)", p);
+    free(p);
 
     reset_hooks();
 }
-- 
1.7.1





More information about the dev mailing list