summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2012-02-15 14:09:53 -0800
committerNick Mathewson <nickm@torproject.org>2012-02-17 11:42:21 -0500
commit33552c16ca3644e2dddd8ba6beee58aabd9d1977 (patch)
treefa08a6b3dbf508f520902e22dbef62da6ef74746 /src/common
parentc0808b795f9b52184a18e7a2960f56ed0e330c4b (diff)
downloadtor-33552c16ca3644e2dddd8ba6beee58aabd9d1977.tar.gz
tor-33552c16ca3644e2dddd8ba6beee58aabd9d1977.zip
Heap-allocate strings returned by get_current_process_environment_variables
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 90ad8c09c6..509477ad84 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3832,8 +3832,8 @@ process_environment_make(struct smartlist_t *env_vars)
* process can put strings not of that form in our environment;
* callers should try to not get crashed by that.
*
- * The returned strings are statically allocated, and must be treated
- * as read-only. */
+ * The returned strings are heap-allocated, and must be freed by the
+ * caller. */
struct smartlist_t *
get_current_process_environment_variables(void)
{
@@ -3841,7 +3841,7 @@ get_current_process_environment_variables(void)
char **environ_tmp; /* Not const char ** ? Really? */
for (environ_tmp = environ; *environ_tmp; ++environ_tmp) {
- smartlist_add(sl, (void *)(*environ_tmp));
+ smartlist_add(sl, tor_strdup(*environ_tmp));
}
return sl;