aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-01-17 12:25:17 +0000
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-01-17 12:25:17 +0000
commitf1e14296a126d036e48212504284925871ba49f4 (patch)
treef0ec6ea1a13ac19e3e1e781ee6858e1de08bc849
parent69fecdd3d64aac4d19a2fa5777ea2b6c017fe9cf (diff)
downloadlcd4linux-f1e14296a126d036e48212504284925871ba49f4.tar.gz
fixed memory leak in using strdup() instead of strdupa()
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1080 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--plugin_i2c_sensors.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c
index 71cbe3e..6092cbf 100644
--- a/plugin_i2c_sensors.c
+++ b/plugin_i2c_sensors.c
@@ -188,7 +188,12 @@ static int parse_i2c_sensors_procfs(const char *key)
return -1;
}
+#ifndef __MAX_OS_X_VERSION_10_3
+ running = strndup(buffer, sizeof(buffer));
+#else
+ // there is no strndup in OSX
running = strdup(buffer);
+#endif
while (1) {
value = strsep(&running, delim);
/* debug("%s pos %i -> %s", file, pos , value); */
@@ -202,6 +207,7 @@ static int parse_i2c_sensors_procfs(const char *key)
pos++;
}
}
+ free(running);
return 0;
}