[librsvg] tools: Fix an incorrect g_new() call



commit 63f008bd20df3bd3379c8e17ff244b10c91859de
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Jan 27 14:02:11 2017 +0000

    tools: Fix an incorrect g_new() call
    
    It was allocating an array of guint8 pointers, rather than an array of
    guint8s. This resulted in an allocation 4 times too large, which is a
    bug, but not one which would cause crashes.
    
    Coverity ID: 1398303
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777833

 tools/rsvg-tools-main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/tools/rsvg-tools-main.c b/tools/rsvg-tools-main.c
index bac7085..33470f0 100644
--- a/tools/rsvg-tools-main.c
+++ b/tools/rsvg-tools-main.c
@@ -53,7 +53,7 @@ read_contents (const gchar *file_name, guint8 **contents, gsize *length)
             gsize bytes_read;
 
             *length = g_file_info_get_size (file_info);
-            *contents = (guint8 *) g_new (guint8*, *length);
+            *contents = g_new (guint8, *length);
             success = g_input_stream_read_all (G_INPUT_STREAM(input_stream),
                                                *contents,
                                                *length,


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