From: INSUN PYO Date: Fri, 23 Oct 2020 01:15:15 +0000 (+0900) Subject: Fix a bug that incorrectly uses putenv X-Git-Tag: accepted/tizen/6.5/unified/20211109.041749^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0e5fc3c681fc86546523b251ba2e39086d59853;p=platform%2Fcore%2Fsystem%2Ftlm.git Fix a bug that incorrectly uses putenv Refer: https://stackoverflow.com/questions/5873029/questions-about-putenv-and-setenv Change-Id: I26f1e7e6ce14f78f827a8440b97baf930b6d3102 (cherry picked from commit 43c2e3bbc25b77ab7f9d56956fc855a4f4b13788) --- diff --git a/src/sessiond/tlm-session.c b/src/sessiond/tlm-session.c index 15cc0a7..af75296 100755 --- a/src/sessiond/tlm-session.c +++ b/src/sessiond/tlm-session.c @@ -423,7 +423,7 @@ reset_exit: static gboolean _set_environment (TlmSessionPrivate *priv) { - gchar **envlist = tlm_auth_session_get_envlist(priv->auth_session); + gchar **envlist = tlm_auth_session_get_envlist(priv->auth_session); gchar *home_dir = NULL, *shell = NULL; if (envlist) { @@ -431,7 +431,7 @@ _set_environment (TlmSessionPrivate *priv) for (env = envlist; *env != NULL; ++env) { DBG ("ENV : %s", *env); putenv(*env); - g_free (*env); + // Don't free *env because putenv uses pointer internally without copying the string. } g_free (envlist); }