aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-06-28 23:49:49 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-06-29 17:58:52 -0700
commit66d0e31b047067054e161cff1a62234565331390 (patch)
treefdf03f70db45dc5b55f830dadeb1538d3b5caa39
parent6f8fc6a5816b2d404ad41a8b84830006a5b473e2 (diff)
dmi_util: make cache static, use cache free function
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r--hardinfo/dmi_util.c2
-rw-r--r--hardinfo/hardinfo.c1
-rw-r--r--includes/dmi_util.h2
3 files changed, 4 insertions, 1 deletions
diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c
index 55e21c4d..627d1cd0 100644
--- a/hardinfo/dmi_util.c
+++ b/hardinfo/dmi_util.c
@@ -235,7 +235,7 @@ char *dmi_chassis_type_str(int chassis_type, gboolean with_val) {
}
/* TODO: something better maybe */
-char *dd_cache[128] = {};
+static char *dd_cache[128] = {};
void dmidecode_cache_free()
{ int i; for(i = 0; i < 128; i++) g_free(dd_cache[i]); }
diff --git a/hardinfo/hardinfo.c b/hardinfo/hardinfo.c
index d1d228b3..6e812fb1 100644
--- a/hardinfo/hardinfo.c
+++ b/hardinfo/hardinfo.c
@@ -161,6 +161,7 @@ int main(int argc, char **argv)
moreinfo_shutdown();
vendor_cleanup();
+ dmidecode_cache_free();
DEBUG("finished");
return exit_code;
diff --git a/includes/dmi_util.h b/includes/dmi_util.h
index efc0ea21..3b6fd3f4 100644
--- a/includes/dmi_util.h
+++ b/includes/dmi_util.h
@@ -51,4 +51,6 @@ dmi_handle_list *dmidecode_match_value(const char *name, const char *value, cons
/* get the first value for name, limiting to optional dmi_type and/or optional handle */
char *dmidecode_match(const char *name, const unsigned long *dmi_type, const unsigned long *handle);
+void dmidecode_cache_free();
+
#endif