|
|
81dd04 |
From 1499d3e2715bad67588b5c0b6c02865eeb65aa16 Mon Sep 17 00:00:00 2001
|
|
|
81dd04 |
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
|
|
81dd04 |
Date: Fri, 8 Jan 2021 17:43:03 +0100
|
|
|
81dd04 |
Subject: [PATCH 3/3] Possible resource leak fix
|
|
|
81dd04 |
|
|
|
81dd04 |
34. fstrm-0.6.0/libmy/argv.c:2238: alloc_fn: Storage is returned from allocation function "realloc".
|
|
|
81dd04 |
35. fstrm-0.6.0/libmy/argv.c:2238: var_assign: Assigning: "argv" = storage returned from "realloc(argv, 8UL * max)".
|
|
|
81dd04 |
37. fstrm-0.6.0/libmy/argv.c:2254: var_assign: Assigning: "argv_p" = "argv".
|
|
|
81dd04 |
47. fstrm-0.6.0/libmy/argv.c:2229: leaked_storage: Variable "argv_p" going out of scope leaks the storage it points to.
|
|
|
81dd04 |
48. fstrm-0.6.0/libmy/argv.c:2229: leaked_storage: Variable "argv" going out of scope leaks the storage it points to.
|
|
|
81dd04 |
---
|
|
|
81dd04 |
libmy/argv.c | 5 +++--
|
|
|
81dd04 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
81dd04 |
|
|
|
81dd04 |
diff --git a/libmy/argv.c b/libmy/argv.c
|
|
|
81dd04 |
index 16dca73..0b28026 100644
|
|
|
81dd04 |
--- a/libmy/argv.c
|
|
|
81dd04 |
+++ b/libmy/argv.c
|
|
|
81dd04 |
@@ -2226,7 +2226,7 @@ static void file_args(const char *path, argv_t *grid,
|
|
|
81dd04 |
*argv_p = string_copy(line);
|
|
|
81dd04 |
if (*argv_p == NULL) {
|
|
|
81dd04 |
*okay_bp = ARGV_FALSE;
|
|
|
81dd04 |
- return;
|
|
|
81dd04 |
+ goto cleanup;
|
|
|
81dd04 |
}
|
|
|
81dd04 |
|
|
|
81dd04 |
argv_p++;
|
|
|
81dd04 |
@@ -2257,7 +2257,8 @@ static void file_args(const char *path, argv_t *grid,
|
|
|
81dd04 |
|
|
|
81dd04 |
/* now do the list */
|
|
|
81dd04 |
do_list(grid, arg_c, argv, queue_list, queue_head_p, queue_tail_p, okay_bp);
|
|
|
81dd04 |
-
|
|
|
81dd04 |
+
|
|
|
81dd04 |
+cleanup:
|
|
|
81dd04 |
/* now free up the list */
|
|
|
81dd04 |
for (argv_p = argv; argv_p < argv + arg_c; argv_p++) {
|
|
|
81dd04 |
free(*argv_p);
|
|
|
81dd04 |
--
|
|
|
81dd04 |
2.26.3
|
|
|
81dd04 |
|