Fix memory leaks
Restrict the use of ps_g to xerror() and main(). Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ecb3050eaa
commit
ed4202b52f
|
@ -2391,7 +2391,6 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
|
||||||
ps->loop = EV_DEFAULT;
|
ps->loop = EV_DEFAULT;
|
||||||
pixman_region32_init(&ps->screen_reg);
|
pixman_region32_init(&ps->screen_reg);
|
||||||
|
|
||||||
ps_g = ps;
|
|
||||||
ps->ignore_tail = &ps->ignore_head;
|
ps->ignore_tail = &ps->ignore_head;
|
||||||
gettimeofday(&ps->time_start, NULL);
|
gettimeofday(&ps->time_start, NULL);
|
||||||
|
|
||||||
|
@ -2555,6 +2554,7 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
|
||||||
NULL);
|
NULL);
|
||||||
if (r) {
|
if (r) {
|
||||||
ps->present_exists = true;
|
ps->present_exists = true;
|
||||||
|
free(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2910,9 +2910,6 @@ session_destroy(session_t *ps) {
|
||||||
ev_signal_stop(ps->loop, &ps->usr1_signal);
|
ev_signal_stop(ps->loop, &ps->usr1_signal);
|
||||||
ev_signal_stop(ps->loop, &ps->int_signal);
|
ev_signal_stop(ps->loop, &ps->int_signal);
|
||||||
|
|
||||||
if (ps == ps_g)
|
|
||||||
ps_g = NULL;
|
|
||||||
|
|
||||||
log_deinit_tls();
|
log_deinit_tls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3019,6 +3016,7 @@ main(int argc, char **argv) {
|
||||||
quit = ps_g->quit;
|
quit = ps_g->quit;
|
||||||
session_destroy(ps_g);
|
session_destroy(ps_g);
|
||||||
free(ps_g);
|
free(ps_g);
|
||||||
|
ps_g = NULL;
|
||||||
} while (!quit);
|
} while (!quit);
|
||||||
|
|
||||||
if (dpy) {
|
if (dpy) {
|
||||||
|
|
Loading…
Reference in New Issue