Blame SOURCES/fstrm-0.6.1-Possible-resource-leak-fix.patch

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