client: Fix a memory leak in client_post_select().
authorAndre Noll <maan@systemlinux.org>
Fri, 15 Jan 2010 19:21:57 +0000 (20:21 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 15 Jan 2010 19:21:57 +0000 (20:21 +0100)
client_common.c

index 2a93d48..bd5a7bf 100644 (file)
@@ -278,7 +278,6 @@ static void client_post_select(struct sched *s, struct task *t)
        case CL_RECEIVING:
                {
                char *buf2;
-               buf2 = para_malloc(CLIENT_BUFSIZE);
                ret = btr_node_status(btrn, 0, BTR_NT_ROOT);
                if (ret < 0)
                        goto err;
@@ -286,6 +285,7 @@ static void client_post_select(struct sched *s, struct task *t)
                        return;
                if (!FD_ISSET(ct->rc4c.fd, &s->rfds))
                        return;
+               buf2 = para_malloc(CLIENT_BUFSIZE);
                ret = client_recv_buffer(ct, buf2, CLIENT_BUFSIZE);
                if (ret < 0) {
                        free(buf2);