From e39038e95cbcc52fe95039e8229e0dd98d86ade9 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sun, 26 Nov 2006 14:13:13 +0000 Subject: Fix segfault; cleanups --- hardinfo2/arch/common/display.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'hardinfo2/arch') diff --git a/hardinfo2/arch/common/display.h b/hardinfo2/arch/common/display.h index b28d34cc..7bab4b50 100644 --- a/hardinfo2/arch/common/display.h +++ b/hardinfo2/arch/common/display.h @@ -21,15 +21,14 @@ get_glx_info(DisplayInfo *di) { gchar *output; if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) { - gchar **output_lines, **old; + gchar **output_lines; + gint i = 0; - output_lines = g_strsplit(output, "\n", 0); - g_free(output); - - old = output_lines; - while (*(++output_lines)) { - if (strstr(*output_lines, "OpenGL")) { - gchar **tmp = g_strsplit(*output_lines, ":", 0); + for (output_lines = g_strsplit(output, "\n", 0); + output_lines && output_lines[i]; + i++) { + if (strstr(output_lines[i], "OpenGL")) { + gchar **tmp = g_strsplit(output_lines[i], ":", 0); tmp[1] = g_strchug(tmp[1]); @@ -41,7 +40,8 @@ get_glx_info(DisplayInfo *di) } } - g_strfreev(old); + g_free(output); + g_strfreev(output_lines); if (!di->ogl_vendor) di->ogl_vendor = "Unknown"; -- cgit v1.2.3