]> Kevux Git Server - fll/commitdiff
Security: The f_iki allocation functions are calling f_memory_destroy() and f_memory_...
authorKevin Day <kevin@kevux.org>
Sat, 22 Jul 2023 15:33:12 +0000 (10:33 -0500)
committerKevin Day <kevin@kevux.org>
Sat, 22 Jul 2023 15:33:12 +0000 (10:33 -0500)
The private_f_iki_datas_adjust() should be called instead of f_memory_destroy().
The private_f_iki_datas_resize() should be called instead of f_memory_delete().

This is because the iki_datass needs the individual sets within to be deallocated.
De-allocating at the top level via the f_memory_destroy() and f_memory_delete() is very probably a memory leak.

level_0/f_iki/c/iki/private-data.c

index 9be4bc31b2b7f4cf26dcf952cf01a8067b27e0fe..0a16fc6ecf006ccfb8b92e340433efe7cbd08ef4 100644 (file)
@@ -169,11 +169,8 @@ extern "C" {
 
     for (f_array_length_t i = length; i < datass->size; ++i) {
 
-      status = f_memory_destroy(datass->array[i].size, sizeof(f_iki_datas_t), (void **) & datass->array[i].array);
+      status = private_f_iki_datas_adjust(0, &datass->array[i]);
       if (F_status_is_error(status)) return status;
-
-      datass->array[i].size = 0;
-      datass->array[i].used = 0;
     } // for
 
     status = f_memory_adjust(datass->size, length, sizeof(f_iki_datas_t), (void **) & datass->array);
@@ -196,11 +193,8 @@ extern "C" {
 
     for (f_array_length_t i = length; i < datass->size; ++i) {
 
-      status = f_memory_delete(datass->array[i].size, sizeof(f_iki_datas_t), (void **) & datass->array[i].array);
+      status = private_f_iki_datas_resize(0, &datass->array[i]);
       if (F_status_is_error(status)) return status;
-
-      datass->array[i].size = 0;
-      datass->array[i].used = 0;
     } // for
 
     status = f_memory_resize(datass->size, length, sizeof(f_iki_datas_t), (void **) & datass->array);