[PATCH] hush: Fix a memory leak in run_command()

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

 



parse_string_outer() calls initialize_context(), too. As the latter
allocates memory make sure to only call it once.

This fixes

	automount -d /mnt/foo true
	ls -l /mnt/foo

dying with a failure to allocate memory. Now it results in an endless loop,
which admittedly is only a little bit better :-)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 common/hush.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/hush.c b/common/hush.c
index 6a089fabf11d..117b273ea4e2 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1887,8 +1887,6 @@ int run_command(const char *cmd)
 	struct p_context ctx = {};
 	int ret;
 
-	initialize_context(&ctx);
-
 	ret = parse_string_outer(&ctx, cmd, FLAG_PARSE_SEMICOLON);
 	release_context(&ctx);
 

base-commit: 298727bc7931fe878fd72a1fa6f35c18bd7c593c
-- 
2.36.1





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux