speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] Do not store pointers to memory owned by dotconf.


From: Christopher Brannon
Subject: [PATCH 1/5] Do not store pointers to memory owned by dotconf.
Date: Mon, 7 Jun 2010 12:08:45 -0500

cmd->data.str is owned by the dotconf library.
You cannot store a pointer to it in SpeechdOptions.arg;
the string must be copied.
---
 src/server/config.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/server/config.c b/src/server/config.c
index a0e890a..2aa4319 100644
--- a/src/server/config.c
+++ b/src/server/config.c
@@ -117,7 +117,7 @@ free_config_options(configoption_t *opts, int *num)
    { \
        if (cl_spec_section) \
          FATAL("This command isn't allowed in a client specific section!"); \
-       if (!SpeechdOptions.arg ## _set) SpeechdOptions.arg = cmd->data.str; \
+       if (!SpeechdOptions.arg ## _set) SpeechdOptions.arg = 
spd_strdup(cmd->data.str); \
        return NULL; \
    }    
 
@@ -137,7 +137,7 @@ free_config_options(configoption_t *opts, int *num)
    { \
        if (cl_spec_section) \
          FATAL("This command isn't allowed in a client specific section!"); \
-       SpeechdOptions.arg = cmd->data.str; \
+       SpeechdOptions.arg = spd_strdup(cmd->data.str); \
        return NULL; \
    }    
 
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]