From 8b30b78eb2fa41ef7f6f21dc09e3cee96abf8a89 Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Tue, 18 Oct 2005 15:39:26 +0000 Subject: Fix memory leak in send_packet --- sockutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sockutil.c b/sockutil.c index b84e456..073685e 100644 --- a/sockutil.c +++ b/sockutil.c @@ -110,10 +110,13 @@ send_packet(int fd, struct qa_packet *qp) { char *packetbuf; int packetsize; + ssize_t ret; packetbuf = malloc(1024); memset(packetbuf, 0, 1024); packetbuf = qptostr(qp, &packetbuf, &packetsize); - return write(fd, packetbuf, packetsize); + ret = write(fd, packetbuf, packetsize); + free(packetbuf); + return ret; } -- cgit