]> 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:59:35 +0000 (23:59 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 13 Mar 2012 23:59:35 +0000 (23:59 +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.
........

Merged revisions 359056 from http://svn.asterisk.org/svn/asterisk/branches/1.8

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

main/pbx.c

index 0891287eb8897b271d2ac10950b0dbeadcc341b1..f9c8c0df008f267f2be626b3cbe06833349f6fd5 100644 (file)
@@ -3257,6 +3257,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);
@@ -3352,7 +3353,6 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
                } else if (!strcmp(var, "ASTLOGDIR")) {
                        s = ast_config_AST_LOG_DIR;
                } else if (!strcmp(var, "ENTITYID")) {
-                       char workspace[20];
                        ast_eid_to_str(workspace, sizeof(workspace), &ast_eid_default);
                        s = workspace;
                }