]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
scriptlive: free resource at the and
authorKarel Zak <kzak@redhat.com>
Thu, 8 Aug 2019 13:36:04 +0000 (15:36 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Oct 2019 11:11:54 +0000 (13:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script-playutils.c
term-utils/script-playutils.h
term-utils/scriptlive.c
term-utils/scriptreplay.c

index 593af5dbe25e3b7dcb8206dfcbc315f8ea806006..c620946da5ee2212fd607f9a2527dc72d58293a6 100644 (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
index 18d96d962083e488df95fb7802bf74e0af8a372a..53b3fd2877d760488320d384cca212f92f9bf26d 100644 (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);
index a27dba89edfb987fbf9e150a6e0818fbdcb212f5..ee41e0c1a24b0ffb8ef7a9c5e8322823db7189e2 100644 (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;
 }
index 906d9c565d33e093c01d16087b4eb30995abd23d..81906946e4bc592c3051d1eb3c84d68a06fd60d4 100644 (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);
 }