From 46bea87ff66e55585bb1c7d1356e5e1332ec7a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 4 Jan 2019 10:20:30 +0200 Subject: [PATCH] MXS-2238: Fix reading of large Avro schemas The schemas were read incorrectly which resulted in large schemas having multiple newlines in them. --- server/modules/routing/avrorouter/avro_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_client.c b/server/modules/routing/avrorouter/avro_client.c index 05b98f747..296b43fdd 100644 --- a/server/modules/routing/avrorouter/avro_client.c +++ b/server/modules/routing/avrorouter/avro_client.c @@ -853,9 +853,7 @@ GWBUF* read_avro_json_schema(const char *avrofile, const char* dir) nread--; } - buffer[nread++] = '\n'; - - GWBUF * newbuf = gwbuf_alloc_and_load(nread, buffer); + GWBUF* newbuf = gwbuf_alloc_and_load(nread, buffer); if (newbuf) { @@ -863,6 +861,8 @@ GWBUF* read_avro_json_schema(const char *avrofile, const char* dir) } } + rval = gwbuf_append(rval, gwbuf_alloc_and_load(1, "\n")); + fclose(file); } else