diff options
author | rbuj <[email protected]> | 2020-06-10 13:27:39 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-06-11 12:59:06 +0200 |
commit | 7366a41a054b54a3bbeb9d039ba2462c9772724b (patch) | |
tree | 8fdf24ee0792ed2ecfd635803efb5aacffd49a57 /plugins/libsensors | |
parent | c97ade764ed2c0f69beeb77663d7143e429fa6e9 (diff) | |
download | mate-sensors-applet-7366a41a054b54a3bbeb9d039ba2462c9772724b.tar.bz2 mate-sensors-applet-7366a41a054b54a3bbeb9d039ba2462c9772724b.tar.xz |
Replace g_malloc0 with g_new0 and g_strdup
Diffstat (limited to 'plugins/libsensors')
-rw-r--r-- | plugins/libsensors/libsensors-plugin.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/libsensors/libsensors-plugin.c b/plugins/libsensors/libsensors-plugin.c index 09d0d96..f911b5c 100644 --- a/plugins/libsensors/libsensors-plugin.c +++ b/plugins/libsensors/libsensors-plugin.c @@ -83,10 +83,11 @@ static char *get_chip_name_string(const sensors_chip_name *chip) { #else /* adapted from lm-sensors:prog/sensors/main.c:sprintf_chip_name in lm-sensors-3.0 */ #define BUF_SIZE 200 - name = g_malloc0(BUF_SIZE); - if (sensors_snprintf_chip_name(name, BUF_SIZE, chip) < 0) { - g_free(name); + static char buf[BUF_SIZE]; + if (sensors_snprintf_chip_name(buf, BUF_SIZE, chip) < 0) { name = NULL; + } else { + name = g_strdup (buf); } #endif |