[gnome-battery-bench] SystemInfo: duplicate string in read_kernel_version



commit f62a66d7d36e0e3589d4a971e41b0d4f7f1c2066
Author: Christian Kellner <gicmo gnome org>
Date:   Fri May 5 14:07:10 2017 +0200

    SystemInfo: duplicate string in read_kernel_version
    
    In the case there we have less then 3 components for the kernel
    we return the un-split string, but we need to make a copy of it
    before.

 src/system-info.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/system-info.c b/src/system-info.c
index be2d570..6cd3cde 100644
--- a/src/system-info.c
+++ b/src/system-info.c
@@ -349,7 +349,7 @@ read_kernel_version(void)
     if (g_strv_length (comps) < 3) {
         char *tmp = data;
         data = NULL;
-        return tmp;
+        return g_strdup(tmp);
     }
 
     return g_strdup(comps[2]);


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