All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] t-runner: Fix mem leak with sim keys
@ 2019-10-22 23:13 Tim Kourt
  2019-10-22 23:13 ` [PATCH 2/7] t-runner: Fix mem leak caused by unclosed dir Tim Kourt
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 742 bytes --]

Use l_settings_get_value instead of l_settings_get_string to
prevent unnecessary memory duplication.
---
 tools/test-runner.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 4551c6c1..430e18e3 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -1961,8 +1961,8 @@ static void create_network_and_run_tests(void *data, void *user_data)
 						HW_CONFIG_SETUP_TMPFS_EXTRAS,
 									':');
 
-	sim_keys = l_settings_get_string(hw_settings, HW_CONFIG_GROUP_SETUP,
-			"sim_keys");
+	sim_keys = l_settings_get_value(hw_settings, HW_CONFIG_GROUP_SETUP,
+								"sim_keys");
 
 	if (sim_keys) {
 		if (!strcmp(sim_keys, "ofono")) {
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] t-runner: Fix mem leak caused by unclosed dir
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-22 23:13 ` [PATCH 3/7] t-runner: Fix mem leak caused by python test names Tim Kourt
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

---
 tools/test-runner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 430e18e3..5045984c 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2413,6 +2413,8 @@ next:
 		l_free(unit_test_abs_path);
 	}
 
+	closedir(d);
+
 exit:
 	l_strfreev(unit_tests);
 }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] t-runner: Fix mem leak caused by python test names
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
  2019-10-22 23:13 ` [PATCH 2/7] t-runner: Fix mem leak caused by unclosed dir Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-22 23:13 ` [PATCH 4/7] t-runner: Fix out-of-bounds write Tim Kourt
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

---
 tools/test-runner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 5045984c..faa5dfa1 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -1089,6 +1089,8 @@ static bool add_path(const char *path, int level, struct l_queue *config_queue)
 		l_queue_insert(config_queue, entry, insert_test_entry, NULL);
 	}
 
+	l_queue_destroy(py_test_queue, l_free);
+
 	closedir(dir);
 	return true;
 }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] t-runner: Fix out-of-bounds write
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
  2019-10-22 23:13 ` [PATCH 2/7] t-runner: Fix mem leak caused by unclosed dir Tim Kourt
  2019-10-22 23:13 ` [PATCH 3/7] t-runner: Fix mem leak caused by python test names Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-22 23:13 ` [PATCH 5/7] t-runner: Fix possible assignment of NULL pointer Tim Kourt
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

---
 tools/test-runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index faa5dfa1..2dc19726 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -1636,7 +1636,7 @@ static void print_test_status(char *test_name, enum test_status ts,
 
 	interval_str = l_malloc(int_len);
 	memset(interval_str, ' ', int_len);
-	interval_str[int_len] = '\0';
+	interval_str[int_len - 1] = '\0';
 
 	if (interval > 0)
 		sprintf(interval_str, "%.3f sec", interval);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] t-runner: Fix possible assignment of NULL pointer
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
                   ` (2 preceding siblings ...)
  2019-10-22 23:13 ` [PATCH 4/7] t-runner: Fix out-of-bounds write Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-22 23:13 ` [PATCH 6/7] t-runner: Check for NULL before using strcmp Tim Kourt
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

---
 tools/test-runner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 2dc19726..0226dd15 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2674,7 +2674,8 @@ static void run_tests(void)
 		test_action_str = ptr + 4;
 
 		ptr = strchr(test_action_str, '\'');
-		*ptr = '\0';
+		if (ptr)
+			*ptr = '\0';
 
 		if (!strcmp(test_action_str, "virtual"))
 			native_hw = false;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] t-runner: Check for NULL before using strcmp
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
                   ` (3 preceding siblings ...)
  2019-10-22 23:13 ` [PATCH 5/7] t-runner: Fix possible assignment of NULL pointer Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-22 23:13 ` [PATCH 7/7] t-runner: Check for errors after opening file Tim Kourt
  2019-10-23  2:57 ` [PATCH 1/7] t-runner: Fix mem leak with sim keys Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

---
 tools/test-runner.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 0226dd15..398494e6 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2957,9 +2957,9 @@ int main(int argc, char *argv[])
 			break;
 		case 'g':
 			gdb_opt = optarg;
-			if (!(!strcmp(gdb_opt, "iwd") ||
-					!strcmp(gdb_opt, "hostapd") ||
-					!strcmp(gdb_opt, "hwsim"))) {
+			if (!gdb_opt || (strcmp(gdb_opt, "iwd") &&
+					strcmp(gdb_opt, "hostapd") &&
+					strcmp(gdb_opt, "hwsim"))) {
 				l_error("--gdb can only be used with iwd"
 					", hwsim or hostapd");
 				return EXIT_FAILURE;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] t-runner: Check for errors after opening file
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
                   ` (4 preceding siblings ...)
  2019-10-22 23:13 ` [PATCH 6/7] t-runner: Check for NULL before using strcmp Tim Kourt
@ 2019-10-22 23:13 ` Tim Kourt
  2019-10-23  2:57 ` [PATCH 1/7] t-runner: Fix mem leak with sim keys Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Tim Kourt @ 2019-10-22 23:13 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

---
 tools/test-runner.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 398494e6..1dfdb9af 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -524,6 +524,9 @@ static pid_t execute_program(char *argv[], char *envp[], bool wait,
 							S_IRUSR | S_IWUSR);
 			}
 
+			if (fd == -1)
+				exit(EXIT_FAILURE);
+
 			dup2(fd, 1);
 			dup2(fd, 2);
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/7] t-runner: Fix mem leak with sim keys
  2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
                   ` (5 preceding siblings ...)
  2019-10-22 23:13 ` [PATCH 7/7] t-runner: Check for errors after opening file Tim Kourt
@ 2019-10-23  2:57 ` Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2019-10-23  2:57 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

Hi Tim,

On 10/22/19 6:13 PM, Tim Kourt wrote:
> Use l_settings_get_value instead of l_settings_get_string to
> prevent unnecessary memory duplication.
> ---
>   tools/test-runner.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

All applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-10-23  2:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 23:13 [PATCH 1/7] t-runner: Fix mem leak with sim keys Tim Kourt
2019-10-22 23:13 ` [PATCH 2/7] t-runner: Fix mem leak caused by unclosed dir Tim Kourt
2019-10-22 23:13 ` [PATCH 3/7] t-runner: Fix mem leak caused by python test names Tim Kourt
2019-10-22 23:13 ` [PATCH 4/7] t-runner: Fix out-of-bounds write Tim Kourt
2019-10-22 23:13 ` [PATCH 5/7] t-runner: Fix possible assignment of NULL pointer Tim Kourt
2019-10-22 23:13 ` [PATCH 6/7] t-runner: Check for NULL before using strcmp Tim Kourt
2019-10-22 23:13 ` [PATCH 7/7] t-runner: Check for errors after opening file Tim Kourt
2019-10-23  2:57 ` [PATCH 1/7] t-runner: Fix mem leak with sim keys Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.