1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

1033: Fixed memory leak in open(...).

This commit is contained in:
Witold Filipczyk 2008-07-16 15:19:34 +02:00 committed by Kalle Olavi Niemitalo
parent 2668602edc
commit e9f3a4a9d3
2 changed files with 12 additions and 8 deletions

View File

@ -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")) {

View File

@ -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;