]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
merge from trunk: move ast_variables_destroy() to a better
authorLuigi Rizzo <rizzo@icir.org>
Wed, 18 Oct 2006 04:09:50 +0000 (04:09 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Wed, 18 Oct 2006 04:09:50 +0000 (04:09 +0000)
place in handle_uri() to avoid leaking memory on non existing files.

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

main/http.c

index 1b7e08a6653774d11ecbfe2e3fb33dff31fcf4c4..0c0a6d9745033a97aa96d12f00f8190f6f9431f3 100644 (file)
@@ -337,7 +337,6 @@ static char *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char **
        }
        if (urih) {
                c = urih->callback(sin, uri, vars, status, title, contentlength);
-               ast_variables_destroy(vars);
        } else if (ast_strlen_zero(uri) && ast_strlen_zero(prefix)) {
                /* Special case: If no prefix, and no URI, send to /static/index.html */
                c = ast_http_error(302, "Moved Temporarily", "Location: /static/index.html\r\n", "This is not the page you are looking for...");
@@ -348,6 +347,7 @@ static char *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char **
                *status = 404;
                *title = strdup("Not Found");
        }
+       ast_variables_destroy(vars);
        return c;
 }