mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
Fix a few possible leaks
This commit is contained in:
parent
0950996dd8
commit
b9316b3a9c
@ -146,15 +146,17 @@ document_get(struct SEE_interpreter *interp, struct SEE_object *o,
|
|||||||
struct form_view *form_view;
|
struct form_view *form_view;
|
||||||
struct js_form *form_object;
|
struct js_form *form_object;
|
||||||
|
|
||||||
|
if (!string) return;
|
||||||
|
|
||||||
foreach (form, document->forms) {
|
foreach (form, document->forms) {
|
||||||
if (!form->name || strcasecmp(string, form->name))
|
if (!form->name || strcasecmp(string, form->name))
|
||||||
continue;
|
continue;
|
||||||
mem_free_if(string);
|
|
||||||
form_view = find_form_view(doc_view, form);
|
form_view = find_form_view(doc_view, form);
|
||||||
form_object = js_get_form_object(interp, doc, form_view);
|
form_object = js_get_form_object(interp, doc, form_view);
|
||||||
SEE_SET_OBJECT(res, (struct SEE_object *)form_object);
|
SEE_SET_OBJECT(res, (struct SEE_object *)form_object);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
mem_free(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,15 +172,14 @@ window_get(struct SEE_interpreter *interp, struct SEE_object *o,
|
|||||||
} else {
|
} else {
|
||||||
unsigned char *frame = SEE_string_to_unsigned_char(p);
|
unsigned char *frame = SEE_string_to_unsigned_char(p);
|
||||||
struct document_view *doc_view = vs->doc_view;
|
struct document_view *doc_view = vs->doc_view;
|
||||||
struct js_window_object *obj =
|
struct js_window_object *obj;
|
||||||
js_try_resolve_frame(doc_view, frame);
|
|
||||||
|
|
||||||
mem_free_if(frame);
|
if (frame && (obj = js_try_resolve_frame(doc_view, frame))) {
|
||||||
if (obj) {
|
|
||||||
SEE_SET_OBJECT(res, (struct SEE_object *)obj);
|
SEE_SET_OBJECT(res, (struct SEE_object *)obj);
|
||||||
} else {
|
} else {
|
||||||
SEE_SET_UNDEFINED(res);
|
SEE_SET_UNDEFINED(res);
|
||||||
}
|
}
|
||||||
|
mem_free_if(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +237,10 @@ js_window_alert(struct SEE_interpreter *interp, struct SEE_object *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
string = SEE_value_to_unsigned_char(interp, argv[0]);
|
string = SEE_value_to_unsigned_char(interp, argv[0]);
|
||||||
if (!string || !*string)
|
if (!string || !*string) {
|
||||||
|
mem_free_if(string);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
info_box(vs->doc_view->session->tab->term, MSGBOX_FREE_TEXT,
|
info_box(vs->doc_view->session->tab->term, MSGBOX_FREE_TEXT,
|
||||||
N_("JavaScript Alert"), ALIGN_CENTER, string);
|
N_("JavaScript Alert"), ALIGN_CENTER, string);
|
||||||
@ -330,7 +331,6 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_free_if(target);
|
|
||||||
if (!get_cmd_opt_bool("no-connect")
|
if (!get_cmd_opt_bool("no-connect")
|
||||||
&& !get_cmd_opt_bool("no-home")
|
&& !get_cmd_opt_bool("no-home")
|
||||||
&& !get_cmd_opt_bool("anonymous")
|
&& !get_cmd_opt_bool("anonymous")
|
||||||
@ -350,6 +350,7 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
mem_free_if(target);
|
||||||
done_uri(uri);
|
done_uri(uri);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user