bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bind_assoc_variable: free key if cannot assign


From: Grisha Levit
Subject: [PATCH] bind_assoc_variable: free key if cannot assign
Date: Thu, 30 May 2024 17:30:57 -0400

Avoid leaking expansion of `x' in `declare -Ar A; A[x]='
---
 arrayfunc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arrayfunc.c b/arrayfunc.c
index e85ba6e5..aaa1963c 100644
--- a/arrayfunc.c
+++ b/arrayfunc.c
@@ -302,6 +302,7 @@ bind_assoc_variable (SHELL_VAR *entry, const char *name, 
char *key, const char *
     {
       if (readonly_p (entry))
        err_readonly (name);
+      FREE (key);
       return (entry);
     }
 
-- 
2.45.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]