]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: alloc: Remove VIR_DISPOSE_STRING
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Feb 2021 15:22:43 +0000 (16:22 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Feb 2021 12:07:14 +0000 (13:07 +0100)
Users were replaced with virSecureEraseString with explicit freeing of
the memory.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/libvirt_private.syms
src/util/viralloc.c
src/util/viralloc.h

index 845e749bdf3aa41e076065add9a5b5c4b0662f09..30589c08ac2d13f80e7396cbfbc117ae7b2fc0d7 100644 (file)
@@ -1726,7 +1726,6 @@ vir_g_strdup_vprintf;
 # util/viralloc.h
 virAllocVar;
 virDeleteElementsN;
-virDisposeString;
 virExpandN;
 virInsertElementsN;
 virReallocN;
index 036007cb53122401df9eeec14a012eeba5c7c7fc..e4dc13b776f01384dc252f6083183101334f63ae 100644 (file)
@@ -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);
-}
index f9387a00f9edf7f9657f046a7015009cade2eb4a..29e3224818f9087ab5b9d1961ed75a03cd4dd995 100644 (file)
@@ -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))