scriptlive: free resource at the and

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2019-08-08 15:36:04 +02:00
parent ab61a03881
commit 263835e824
4 changed files with 18 additions and 5 deletions

View File

@ -102,7 +102,18 @@ static inline void timerinc(struct timeval *a, struct timeval *b)
struct replay_setup *replay_new_setup(void)
{
return xcalloc(1, sizeof(struct replay_setup));
return xcalloc(1, sizeof(struct replay_setup));
}
void replay_free_setup(struct replay_setup *stp)
{
if (!stp)
return;
free(stp->logs);
free(stp->step.name);
free(stp->step.value);
free(stp);
}
/* if timing file does not contains types of entries (old format) than use this

View File

@ -27,7 +27,7 @@ struct replay_step;
void replay_init_debug(void);
struct replay_setup *replay_new_setup(void);
void replay_free_setup(struct replay_setup *stp);
int replay_set_default_type(struct replay_setup *stp, char type);
int replay_set_crmode(struct replay_setup *stp, int mode);

View File

@ -318,8 +318,6 @@ main(int argc, char *argv[])
cb->child_sigstop = child_sigstop;
cb->mainloop = mainloop_cb;
sigprocmask(SIG_BLOCK, NULL, ul_pty_get_orig_sigset(ss.pty));
if (ul_pty_setup(ss.pty))
err(EXIT_FAILURE, "failed to create pseudo-terminal");
@ -378,7 +376,9 @@ main(int argc, char *argv[])
}
ul_pty_cleanup(ss.pty);
fprintf(stdout, _("\n>>> scriptlive: done. <<<\n"));
ul_free_pty(ss.pty);
replay_free_setup(ss.setup);
fprintf(stdout, _("\n>>> scriptlive: done. <<<\n"));
return EXIT_SUCCESS;
}

View File

@ -307,5 +307,7 @@ main(int argc, char *argv[])
replay_get_timing_file(setup),
replay_get_timing_line(setup));
printf("\n");
replay_free_setup(setup);
exit(EXIT_SUCCESS);
}