diff --git a/src/ecmascript/see/window.c b/src/ecmascript/see/window.c index 5b3d3a558..513b962e5 100644 --- a/src/ecmascript/see/window.c +++ b/src/ecmascript/see/window.c @@ -240,7 +240,7 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self, struct document_view *doc_view = vs->doc_view; struct session *ses = doc_view->session; unsigned char *frame = ""; - unsigned char *url; + unsigned char *url, *url2; struct uri *uri; struct SEE_value url_value; #if 0 @@ -291,10 +291,11 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self, } /* TODO: Support for window naming and perhaps some window features? */ - url = join_urls(doc_view->document->uri, url); - if (!url) return; - uri = get_uri(url, 0); + url2 = join_urls(doc_view->document->uri, url); mem_free(url); + if (!url2) return; + uri = get_uri(url2, 0); + mem_free(url2); if (!uri) return; if (*frame && strcasecmp(frame, "_blank")) { diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index a08b9e8ec..ea8fe82cc 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -342,7 +342,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) struct document_view *doc_view; struct session *ses; unsigned char *frame = ""; - unsigned char *url; + unsigned char *url, *url2; struct uri *uri; static time_t ratelimit_start; static int ratelimit_count; @@ -387,10 +387,13 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) /* TODO: Support for window naming and perhaps some window features? */ - url = join_urls(doc_view->document->uri, url); - if (!url) return JS_TRUE; - uri = get_uri(url, 0); + url2 = join_urls(doc_view->document->uri, url); mem_free(url); + if (!url2) { + return JS_TRUE; + } + uri = get_uri(url2, 0); + mem_free(url2); if (!uri) return JS_TRUE;