lib/self_exec.c: Fix leaks and remove redundant code

This patch free args before returning from function to avoid memory
leaks and remove redundant code in self_exec().

Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Signed-off-by: Yogesh Gaur <yn.gaur@samsung.com>
diff --git a/lib/self_exec.c b/lib/self_exec.c
index 1de1a7e..94f85b6 100644
--- a/lib/self_exec.c
+++ b/lib/self_exec.c
@@ -117,6 +117,7 @@
 				}
 				if (j != i) {
 					va_end(ap);
+					free(args);
 					return;
 				}
 				break;
@@ -144,7 +145,7 @@
 		}
 
 		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 @@
 	}
 
 	arg = strdup(tmp_cwd);
-
-	if ((arg = strdup(tmp_cwd)) == NULL) {
+	if (arg == NULL) {
 		tst_resm(TBROK, "Could not produce self_exec string");
 		return -1;
 	}