summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2005-10-18 15:39:26 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:45 -0400
commit8b30b78eb2fa41ef7f6f21dc09e3cee96abf8a89 (patch)
tree783810563768dd834dcbd5495e6213b96ac140a7
parent88b74ed48b49741a0de7bc11316c89ae58ea2d8d (diff)
downloadqarsh-8b30b78eb2fa41ef7f6f21dc09e3cee96abf8a89.tar.gz
qarsh-8b30b78eb2fa41ef7f6f21dc09e3cee96abf8a89.tar.xz
qarsh-8b30b78eb2fa41ef7f6f21dc09e3cee96abf8a89.zip
Fix memory leak in send_packet
-rw-r--r--sockutil.c5
1 files changed, 4 insertions, 1 deletions
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;
}