aboutsummaryrefslogtreecommitdiff
path: root/modules/computer
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2017-07-31 19:53:25 -0700
committerLeandro Pereira <leandro@hardinfo.org>2017-08-04 09:23:23 -0700
commite42e6adf46025eb0ed8ac03c5bac672d52fafb4a (patch)
tree95bef53f23afd8898fa20147256fba48457aceb4 /modules/computer
parent3ec07bbb0f6f67215eceb3952efb97032bd4c1a9 (diff)
Plug memleak when detecting distribution
If the output of `lsb_release -d` didn't contain a "Description: " substring, it would leak.
Diffstat (limited to 'modules/computer')
-rw-r--r--modules/computer/os.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/computer/os.c b/modules/computer/os.c
index 806ccce6..6accc0a3 100644
--- a/modules/computer/os.c
+++ b/modules/computer/os.c
@@ -328,12 +328,10 @@ detect_distro(void)
int i;
if (g_spawn_command_line_sync("lsb_release -d", &contents, NULL, NULL, NULL)) {
- gchar *tmp = strstr(contents, "Description:\t");
+ gchar *tmp = strstr(idle_free(contents), "Description:\t");
- if (tmp) {
- idle_free(contents);
+ if (tmp)
return g_strdup(tmp + strlen("Description:\t"));
- }
}
for (i = 0; distro_db[i].file; i++) {