From 564c043256e7de07bef72e9cb98d34cb58160b7f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 17 Jun 2014 10:23:27 -0400 Subject: [PATCH] Fix off by one error in allocation filenames is a null-terminated array of pointers. g_strv_length (filenames) returns the number of elements, excluding the null element. Since we want out_paths to be a null-terminated array as well, we need to account for the null element in the allocation. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index f0ba015..ba19329 100644 --- a/src/main.c +++ b/src/main.c @@ -137,7 +137,7 @@ parole_send_files (gchar **filenames, gboolean enqueue) if ( !proxy ) g_error ("Unable to create proxy for %s", PAROLE_DBUS_NAME); - out_paths = g_new0 (gchar *, g_strv_length (filenames)); + out_paths = g_new0 (gchar *, g_strv_length (filenames) + 1); for ( i = 0; filenames && filenames[i]; i++) { -- 2.0.0