Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Coverity CID 439086 fix potential leak of prog in ptyread()



This was originally marked as a false positive because the allocation
was done with PAT_STATIC; when that was later changed to PAT_ZDUP to
avoid problems with signal handlers stomping on the memory, apparently
this cleanup path was missed.
---
 Src/Modules/zpty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index c2656698c5..b766865dd1 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -690,6 +690,8 @@ ptyread(char *nam, Ptycmd cmd, char **args, int noblock, int mustmatch)
 	) {
 	cmd->old = (char *) zalloc(cmd->olen = used);
 	memcpy(cmd->old, buf, cmd->olen);
+	if (prog)
+	    freepatprog(prog);
 
 	return 1;
     }
-- 
2.38.1





Messages sorted by: Reverse Date, Date, Thread, Author