Changeset: 64de45510741 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64de45510741
Modified Files:
        clients/mapilib/mapi.c
        common/stream/stream.c
        monetdb5/modules/mal/mal_mapi.c
Branch: protocol
Log Message:

Properly free block stream headers.


diffs (60 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2921,13 +2921,16 @@ mapi_reconnect(Mapi mid)
        check_stream(mid, mid->to, "Could not send initial byte sequence", 
"mapi_reconnect", mid->error);
 
        if (prot_version == PROTOCOL_10) {
+               stream *from, *to;
                //printf("Using protocol version %s.\n", prot_version == prot10 
 ? "PROT10" : "PROT10COMPR");
                assert(isa_block_stream(mid->to));
                assert(isa_block_stream(mid->from));
-
-               // FIXME: this leaks a block stream header
-               mid->to = block_stream2(bs_stream(mid->to), mid->blocksize, 
comp, mid->colcomp);
-               mid->from = block_stream2(bs_stream(mid->from), mid->blocksize, 
comp, mid->colcomp);
+               from = bs_stream(mid->from);
+               to = bs_stream(mid->to);
+               free(mid->from);
+               free(mid->to);
+               mid->to = block_stream2(to, mid->blocksize, comp, mid->colcomp);
+               mid->from = block_stream2(from, mid->blocksize, comp, 
mid->colcomp);
        }
 
        /* consume the welcome message from the server */
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -3937,10 +3937,6 @@ stream* bs_stream(stream *s) {
        return ((bs*)s->stream_data.p)->s;
 }
 
-// FIXME: patch bs_read/bs_write etc
-// 10 MB max buffer size or so
-// unsigned int length or so
-
 stream *
 block_stream(stream *s)
 {
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -242,9 +242,15 @@ doChallenge(void *data)
                        return;
                }
 
-               // FIXME: this leaks a block stream header
-               fdin = block_stream2(bs_stream(fdin), buflen, comp, colcomp);
-               fdout = block_stream2(bs_stream(fdout), buflen, comp, colcomp);
+               {
+                       stream *from, *to;
+                       from = bs_stream(fdin);
+                       to = bs_stream(fdout);
+                       free(fdin);
+                       free(fdout);
+                       fdin = block_stream2(from, buflen, comp, colcomp);
+                       fdout = block_stream2(to, buflen, comp, colcomp);
+               }
 
                if (fdin == NULL || fdout == NULL) {
                        GDKsyserror("SERVERlisten:"MAL_MALLOC_FAIL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to