]> code.delx.au - pulseaudio/commitdiff
Use setenv instead of putenv
authorMaarten Bosmans <mkbosmans@gmail.com>
Wed, 12 Jan 2011 07:15:44 +0000 (08:15 +0100)
committerMaarten Bosmans <mkbosmans@gmail.com>
Thu, 17 Feb 2011 10:58:21 +0000 (11:58 +0100)
In theory putenv could be used to handle freeing of strings yourself, but this
was not done in PulseAudio.  That leaves no advantages in using putenv.  With
setenv you're at the mercy of the implementation whether the strings leak, but
at least that is better then a certain leak, as it was before.

src/pulsecore/core-util.c

index 4e7d0d71c76a5763064b0ee9b2223fb4d735bf58..ec0b338de23582645430527d0478044eaeed095d 100644 (file)
@@ -2501,7 +2501,7 @@ void pa_set_env(const char *key, const char *value) {
 
     /* This is not thread-safe */
 
-    putenv(pa_sprintf_malloc("%s=%s", key, value));
+    setenv(key, value, 1);
 }
 
 void pa_set_env_and_record(const char *key, const char *value) {