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

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