BUG: ssh-agent memory leak

Damien Miller djm at mindrot.org
Sun Apr 30 00:43:06 EST 2000


On Sat, 29 Apr 2000, J. Paul Reed wrote:

> 
> Hey all!
> 
> I've been using OpenSSH on Linux since version 1.2.2; great work...
> 
> There is, however, a pretty noticable memory leak in ssh-agent.

Found and fixed in the next version. Here's a patch for now:

--- ssh-agent.c	2000/04/16 02:31:52	1.20
+++ ssh-agent.c	2000/04/21 05:55:21	1.23
@@ -440,6 +440,8 @@
 					shutdown(sockets[i].fd, SHUT_RDWR);
 					close(sockets[i].fd);
 					sockets[i].type = AUTH_UNUSED;
+					buffer_free(&sockets[i].input);
+					buffer_free(&sockets[i].output);
 					break;
 				}
 				buffer_consume(&sockets[i].output, len);
@@ -450,6 +452,8 @@
 					shutdown(sockets[i].fd, SHUT_RDWR);
 					close(sockets[i].fd);
 					sockets[i].type = AUTH_UNUSED;
+					buffer_free(&sockets[i].input);
+					buffer_free(&sockets[i].output);
 					break;
 				}
 				buffer_append(&sockets[i].input, buf, len);

-- 
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)








More information about the openssh-unix-dev mailing list