: Fix memory leaks and remove redundant code
PATCH 1/1 : Fix memory leaks and remove redundant code
From: Manjeet Pawar <[email protected]>
Subject: [PATCH] lib/self_exec.c: free args before returning from function to avoid memory leaks and remove redundant code in self_exec()
This patch free args before returning from function to avoid memory leaks and remove redundant code in self_exec()
Signed-off-by Manjeet Pawar <[email protected]>
Signed-off-by Yogesh Gaur <[email protected]>
--- lib/self_exec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/self_exec.c +3 -3
@@ -117,6 +117,7 @@ void maybe_run_child(void (*child) (), char *fmt, ...) }if (j != i) {va_end (ap); +free (args);return ; }break ;
@@ -144,7 +145,7 @@ void maybe_run_child(void (*child) (), char *fmt, ...) }va_end (ap); - +free (args);if (chdir (child_dir) <0 )tst_brkm (TBROK ,NULL ,"Could not change to %s for child" , child_dir);
@@ -170,8 +171,7 @@ int self_exec(char *argv0, char *fmt, ...) } arg =strdup (tmp_cwd); - -if ((arg =strdup (tmp_cwd)) ==NULL ) { +if (arg ==NULL ) {tst_resm (TBROK ,"Could not produce self_exec string" );return -1 ; }
Signature · 7 lines
1.7.9.5 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Pushed, thanks.
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list