[glib: 1/3] garray: Fix NULL-termination of GPtrArray copies




commit c11e64e7ae5665590c9d7c7ecc07594e9b55e7dd
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jun 7 09:36:57 2022 +0100

    garray: Fix NULL-termination of GPtrArray copies
    
    The code was accidentally NULL-terminating the source array rather than
    the copy.
    
    This fixes commit ee247c0a2d.
    
    Spotted by the `array-test` installed test in
    https://gitlab.gnome.org/GNOME/glib/-/jobs/2047993.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/garray.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/garray.c b/glib/garray.c
index 920a402584..fe9e570e9f 100644
--- a/glib/garray.c
+++ b/glib/garray.c
@@ -1285,7 +1285,7 @@ g_ptr_array_copy (GPtrArray *array,
           new_array->len = array->len;
         }
 
-      ptr_array_null_terminate (rarray);
+      ptr_array_null_terminate ((GRealPtrArray *) new_array);
     }
 
   return new_array;


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