[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libvir-list
Subject:    [libvirt] [PATCH 2/8] nssmock: Prefer free() over VIR_FREE()
From:       Michal Privoznik <mprivozn () redhat ! com>
Date:       2016-11-30 9:59:29
Message-ID: ad47f3bfd511f3a4bb16ed4fa244a699de9c5d96.1480499368.git.mprivozn () redhat ! com
[Download RAW message or body]

Problem with VIR_FREE() is that we are not linking
libvirt-utils.so to our mock libs therefore there will be an
unresolved symbol. Fortunately, nsstest that eventually links
with the nssmock links also with libvirt-utils.so and thus the
symbol is resolved after all. However, if one wants to run the
test binary under valgrind it is impossible to do so. Because of
the unresolved symbol.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 cfg.mk          | 2 +-
 tests/nssmock.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index a4305a8..69e3f3a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1159,7 +1159,7 @@ exclude_file_name_regexp--sc_prohibit_select = \
 	^cfg\.mk$$
 
 exclude_file_name_regexp--sc_prohibit_raw_allocation = \
-  ^(docs/hacking\.html\.in|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|vircgroupmock)\.c|tools/wireshark/src/packet-libvirt\.c)$$
 +  ^(docs/hacking\.html\.in|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock)\.c|tools/wireshark/src/packet-libvirt\.c)$$
  
 exclude_file_name_regexp--sc_prohibit_readlink = \
   ^src/(util/virutil|lxc/lxc_container)\.c$$
diff --git a/tests/nssmock.c b/tests/nssmock.c
index b0259a3..273af06 100644
--- a/tests/nssmock.c
+++ b/tests/nssmock.c
@@ -91,7 +91,7 @@ open(const char *path, int flags, ...)
         ret = real_open(newpath ? newpath : path, flags);
     }
 
-    VIR_FREE(newpath);
+    free(newpath);
     return ret;
 }
 
@@ -109,7 +109,7 @@ opendir(const char *path)
 
     ret = real_opendir(newpath ? newpath : path);
 
-    VIR_FREE(newpath);
+    free(newpath);
     return ret;
 }
 #else
-- 
2.8.4


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic