[Libguestfs] [PATCH 2/4] daemon: add CLEANUP_FREE_STRINGSBUF

Pino Toscano ptoscano at redhat.com
Wed Jun 17 16:09:56 UTC 2015


---
 daemon/daemon.h   | 3 +++
 daemon/guestfsd.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/daemon/daemon.h b/daemon/daemon.h
index bed4dbc..d3ba148 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -178,6 +178,7 @@ extern void cleanup_free_string_list (void *ptr);
 extern void cleanup_unlink_free (void *ptr);
 extern void cleanup_close (void *ptr);
 extern void cleanup_aug_close (void *ptr);
+extern void cleanup_free_stringsbuf (void *ptr);
 
 /*-- in names.c (auto-generated) --*/
 extern const char *function_names[];
@@ -458,12 +459,14 @@ is_zero (const char *buffer, size_t size)
 #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free)))
 #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close)))
 #define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close)))
+#define CLEANUP_FREE_STRINGSBUF __attribute__((cleanup(cleanup_free_stringsbuf)))
 #else
 #define CLEANUP_FREE
 #define CLEANUP_FREE_STRING_LIST
 #define CLEANUP_UNLINK_FREE
 #define CLEANUP_CLOSE
 #define CLEANUP_AUG_CLOSE
+#define CLEANUP_FREE_STRINGSBUF
 #endif
 
 #endif /* GUESTFSD_DAEMON_H */
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 453dee1..a571aad 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -1539,3 +1539,9 @@ cleanup_aug_close (void *ptr)
   if (aug != NULL)
     aug_close (aug);
 }
+
+void
+cleanup_free_stringsbuf (void *ptr)
+{
+  free_stringsbuf ((struct stringsbuf *) ptr);
+}
-- 
2.1.0




More information about the Libguestfs mailing list