aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-06-25 19:21:14 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-06-25 17:48:11 -0700
commit14a4a88e36aba4f7edcd6ecdf0dbf90190f7d64f (patch)
tree9f689ae41f6d1babb1ddc4d25e2169fa18aeaeb8
parent5f475657e3b93a423e3b16c1aff979055352c323 (diff)
devices/dmi_memory.c: fix no dmi case
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r--modules/devices/dmi_memory.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/devices/dmi_memory.c b/modules/devices/dmi_memory.c
index dd5c298a..915ea679 100644
--- a/modules/devices/dmi_memory.c
+++ b/modules/devices/dmi_memory.c
@@ -111,6 +111,7 @@ typedef struct {
} dmi_mem_socket;
typedef struct {
+ gboolean empty;
GSList *arrays;
GSList *sockets;
} dmi_mem;
@@ -235,6 +236,11 @@ dmi_mem *dmi_mem_new() {
dmi_handle_list_free(hlm);
}
+ if (!m->sockets && !m->arrays) {
+ m->empty = 1;
+ return m;
+ }
+
/* update array present devices/size */
GSList *l = NULL;
for(l = m->sockets; l; l = l->next) {
@@ -350,9 +356,9 @@ gchar *dmi_mem_socket_info() {
}
no_handles = FALSE;
- if(!mem) {
+ if(mem->empty) {
no_handles = TRUE;
- ret = g_strdup_printf("[%s]\n%s=%s\n",
+ ret = g_strdup_printf("[%s]\n%s=%s\n" "[$ShellParam$]\nViewType=0\n",
_("Socket Information"), _("Result"),
(getuid() == 0)
? _("(Not available)")