mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
762: Instead of setting a bare pointer for task.target.frame always
use the dynamically allocated value. null_or_stracpy and mem_free_set macros are used. Slower, but safer.
This commit is contained in:
parent
687f19dbde
commit
ba70d61051
@ -1063,14 +1063,14 @@ tp_display(struct type_query *type_query)
|
||||
struct view_state *vs;
|
||||
struct session *ses = type_query->ses;
|
||||
struct uri *loading_uri = ses->loading_uri;
|
||||
unsigned char *target_frame = ses->task.target.frame;
|
||||
unsigned char *target_frame = null_or_stracpy(ses->task.target.frame);
|
||||
|
||||
ses->loading_uri = type_query->uri;
|
||||
ses->task.target.frame = type_query->target_frame;
|
||||
mem_free_set(&ses->task.target.frame, null_or_stracpy(type_query->target_frame));
|
||||
vs = ses_forward(ses, /* type_query->frame */ 0);
|
||||
if (vs) vs->plain = 1;
|
||||
ses->loading_uri = loading_uri;
|
||||
ses->task.target.frame = target_frame;
|
||||
mem_free_set(&ses->task.target.frame, target_frame);
|
||||
|
||||
if (/* !type_query->frame */ 1) {
|
||||
struct download *old = &type_query->download;
|
||||
|
@ -659,13 +659,13 @@ file_loading_callback(struct download *download, struct file_to_load *ftl)
|
||||
if (ftl->cached && !ftl->cached->redirect_get && download->pri != PRI_CSS) {
|
||||
struct session *ses = ftl->ses;
|
||||
struct uri *loading_uri = ses->loading_uri;
|
||||
unsigned char *target_frame = ses->task.target.frame;
|
||||
unsigned char *target_frame = null_or_stracpy(ses->task.target.frame);
|
||||
|
||||
ses->loading_uri = ftl->uri;
|
||||
ses->task.target.frame = ftl->target_frame;
|
||||
mem_free_set(&ses->task.target.frame, null_or_stracpy(ftl->target_frame));
|
||||
setup_download_handler(ses, &ftl->download, ftl->cached, 1);
|
||||
ses->loading_uri = loading_uri;
|
||||
ses->task.target.frame = target_frame;
|
||||
mem_free_set(&ses->task.target.frame, target_frame);
|
||||
}
|
||||
|
||||
doc_loading_callback(download, ftl->ses);
|
||||
@ -1237,7 +1237,7 @@ reload_frame(struct session *ses, unsigned char *name,
|
||||
loc->download.data = ses;
|
||||
loc->download.callback = (download_callback_T *) doc_loading_callback;
|
||||
|
||||
ses->task.target.frame = name;
|
||||
mem_free_set(&ses->task.target.frame, null_or_stracpy(name));
|
||||
|
||||
load_uri(loc->vs.uri, ses->referrer, &loc->download, PRI_MAIN, cache_mode, -1);
|
||||
|
||||
|
@ -49,6 +49,7 @@ free_task(struct session *ses)
|
||||
ses->loading_uri = NULL;
|
||||
}
|
||||
ses->task.type = TASK_NONE;
|
||||
mem_free_set(&ses->task.target.frame, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -78,7 +79,7 @@ ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
ses->loading_uri = uri;
|
||||
|
||||
ses->task.type = task_type;
|
||||
ses->task.target.frame = target_frame;
|
||||
mem_free_set(&ses->task.target.frame, null_or_stracpy(target_frame));
|
||||
ses->task.target.location = target_location;
|
||||
|
||||
load_uri(ses->loading_uri, ses->referrer, &ses->loading,
|
||||
@ -231,7 +232,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
task->uri = get_uri_reference(uri);
|
||||
task->cache_mode = cache_mode;
|
||||
task->session_task.type = task_type;
|
||||
task->session_task.target.frame = target_frame;
|
||||
task->session_task.target.frame = null_or_stracpy(target_frame);
|
||||
task->session_task.target.location = target_location;
|
||||
|
||||
if (malicious_uri) {
|
||||
@ -322,7 +323,7 @@ x:
|
||||
del_from_history(&ses->history, loc);
|
||||
destroy_location(loc);
|
||||
}
|
||||
ses->task.target.frame = NULL;
|
||||
mem_free_set(&ses->task.target.frame, NULL);
|
||||
goto x;
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ goto_current_link(struct session *ses, struct document_view *doc_view, int do_re
|
||||
|
||||
if (link->type == LINK_MAP) {
|
||||
/* TODO: Test reload? */
|
||||
goto_imgmap(ses, uri, null_or_stracpy(link->target));
|
||||
goto_imgmap(ses, uri, link->target);
|
||||
|
||||
} else {
|
||||
enum cache_mode mode = do_reload ? CACHE_MODE_FORCE_RELOAD
|
||||
|
Loading…
Reference in New Issue
Block a user