[gnome-settings-daemon/gnome-3-16] wacom: Fix freeing buffer in OLED helper



commit 9bff3a333923ddd5b32e55973b5daa5b3310560e
Author: Bastien Nocera <hadess hadess net>
Date:   Tue May 26 11:44:41 2015 +0200

    wacom: Fix freeing buffer in OLED helper
    
    We can't free "", buffer needs to be set by the command-line options,
    but we never check that it got set.
    
    From coverity:
    gnome-settings-daemon-3.14.4/plugins/wacom/gsd-wacom-oled-helper.c:415: incorrect_free: "g_free" frees 
incorrect pointer "buffer".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749882

 plugins/wacom/gsd-wacom-oled-helper.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-oled-helper.c b/plugins/wacom/gsd-wacom-oled-helper.c
index 511a120..86f2891 100644
--- a/plugins/wacom/gsd-wacom-oled-helper.c
+++ b/plugins/wacom/gsd-wacom-oled-helper.c
@@ -339,7 +339,7 @@ int main (int argc, char **argv)
        GsdWacomOledType type;
 
        char *path = NULL;
-       char *buffer = "";
+       char *buffer = NULL;
        int button_num = -1;
 
        const GOptionEntry options[] = {
@@ -363,7 +363,8 @@ int main (int argc, char **argv)
        g_option_context_parse (context, &argc, &argv, NULL);
 
        if (path == NULL ||
-           button_num < 0) {
+           button_num < 0 ||
+           buffer == NULL) {
                char *txt;
 
                txt = g_option_context_get_help (context, FALSE, NULL);


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