[PATCH v2 27/27] util: alloc: Remove VIR_DISPOSE_STRING

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Users were replaced with virSecureEraseString with explicit freeing of
the memory.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/libvirt_private.syms |  1 -
 src/util/viralloc.c      | 17 -----------------
 src/util/viralloc.h      | 14 --------------
 3 files changed, 32 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 845e749bdf..30589c08ac 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1726,7 +1726,6 @@ vir_g_strdup_vprintf;
 # util/viralloc.h
 virAllocVar;
 virDeleteElementsN;
-virDisposeString;
 virExpandN;
 virInsertElementsN;
 virReallocN;
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 036007cb53..e4dc13b776 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -293,20 +293,3 @@ int virAllocVar(void *ptrptr,
     *(void **)ptrptr = g_malloc0(alloc_size);
     return 0;
 }
-
-
-/**
- * virDisposeString:
- * @ptrptr: pointer to pointer for a string which should be sanitized and cleared
- *
- * See virDispose.
- */
-void
-virDisposeString(char **strptr)
-{
-    if (!*strptr)
-        return;
-
-    memset(*strptr, 0, strlen(*strptr));
-    g_clear_pointer(strptr, g_free);
-}
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index f9387a00f9..29e3224818 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -52,9 +52,6 @@ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
 int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count)
     G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);

-void virDisposeString(char **strptr)
-    ATTRIBUTE_NONNULL(1);
-
 /**
  * VIR_REALLOC_N:
  * @ptr: pointer to hold address of allocated memory
@@ -338,14 +335,3 @@ void virDisposeString(char **strptr)
  * This macro is safe to use on arguments with side effects.
  */
 #define VIR_FREE(ptr) g_clear_pointer(&(ptr), g_free)
-
-
-/**
- * VIR_DISPOSE_STRING:
- * @ptr: pointer to a string to be cleared and freed
- *
- * Clears the string and frees the corresponding memory.
- *
- * This macro is not safe to be used on arguments with side effects.
- */
-#define VIR_DISPOSE_STRING(ptr) virDisposeString(&(ptr))
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux