]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't use a buffer after it goes out of scope.
authorRussell Bryant <russell@russellbryant.com>
Tue, 13 Mar 2012 23:58:40 +0000 (23:58 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 13 Mar 2012 23:58:40 +0000 (23:58 +0000)
's' is set to 'workspace'.  Make sure 'workspace' doesn't go out of scope while
the reference to it via 's' is still used.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@359056 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index 44b4a3f92195a6a3ebf89a2e38b4c1dcba357e9b..7e6cadaa984aca4730e5391ed5e2527a245900ec 100644 (file)
@@ -3136,6 +3136,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
        int offset, length;
        int i, need_substring;
        struct varshead *places[2] = { headp, &globals };       /* list of places where we may look */
+       char workspace[20];
 
        if (c) {
                ast_channel_lock(c);
@@ -3211,7 +3212,6 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
                } else if (!strcmp(var, "SYSTEMNAME")) {
                        s = ast_config_AST_SYSTEM_NAME;
                } else if (!strcmp(var, "ENTITYID")) {
-                       char workspace[20];
                        ast_eid_to_str(workspace, sizeof(workspace), &ast_eid_default);
                        s = workspace;
                }