diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-11-26 14:13:13 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-11-26 14:13:13 +0000 |
commit | e39038e95cbcc52fe95039e8229e0dd98d86ade9 (patch) | |
tree | 8b94a46fc16fc1f036dc28b2a7c23c2250518712 /hardinfo2/arch/common/display.h | |
parent | ccd5ecd04700586b66f68753c8a3bf2f1e19aa39 (diff) |
Fix segfault; cleanups
Diffstat (limited to 'hardinfo2/arch/common/display.h')
-rw-r--r-- | hardinfo2/arch/common/display.h | 18 |
1 files changed, 9 insertions, 9 deletions
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"; |