1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-27 07:22:07 +03:00

util: alloc: Remove VIR_DISPOSE_STRING

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>
This commit is contained in:
Peter Krempa 2021-02-02 16:22:43 +01:00
parent de4d0103b6
commit ed97683897
3 changed files with 0 additions and 32 deletions

View File

@ -1726,7 +1726,6 @@ vir_g_strdup_vprintf;
# util/viralloc.h # util/viralloc.h
virAllocVar; virAllocVar;
virDeleteElementsN; virDeleteElementsN;
virDisposeString;
virExpandN; virExpandN;
virInsertElementsN; virInsertElementsN;
virReallocN; virReallocN;

View File

@ -293,20 +293,3 @@ int virAllocVar(void *ptrptr,
*(void **)ptrptr = g_malloc0(alloc_size); *(void **)ptrptr = g_malloc0(alloc_size);
return 0; 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);
}

View 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) int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count)
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1); G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
void virDisposeString(char **strptr)
ATTRIBUTE_NONNULL(1);
/** /**
* VIR_REALLOC_N: * VIR_REALLOC_N:
* @ptr: pointer to hold address of allocated memory * @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. * This macro is safe to use on arguments with side effects.
*/ */
#define VIR_FREE(ptr) g_clear_pointer(&(ptr), g_free) #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))