mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 12:50:17 +01:00
libnm: fix clearing memory in file_to_secure_bytes()
If we go through the lengths of clearing the allocated
memory, we must not forget @contents.
(cherry picked from commit 88a79625a6)
This commit is contained in:
parent
fa5a6caf2b
commit
ef3cd489e1
1 changed files with 1 additions and 1 deletions
|
|
@ -1755,7 +1755,7 @@ file_to_secure_bytes (const char *filename)
|
|||
if (g_file_get_contents (filename, &contents, &length, NULL)) {
|
||||
array = g_byte_array_sized_new (length);
|
||||
g_byte_array_append (array, (guint8 *) contents, length);
|
||||
g_assert (array->len == length);
|
||||
memset (contents, 0, length);
|
||||
g_free (contents);
|
||||
return g_bytes_new_with_free_func (array->data, array->len, free_secure_bytes, array);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue