Changeset: f877fec382a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f877fec382a7
Modified Files:
        monetdb5/mal/mal_import.c
        sql/backends/monet5/sql_scenario.c
        
sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.err
        
sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.out
Branch: default
Log Message:

Merge with Jul2017 branch.


diffs (116 lines):

diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -170,19 +170,31 @@ malInclude(Client c, str name, int listi
        (void) p;
        {
                size_t mal_init_len = strlen(mal_init_inline);
-               buffer* mal_init_buf = buffer_create(mal_init_len);
-               stream* mal_init_stream = buffer_rastream(mal_init_buf, name);
+               buffer* mal_init_buf;
+               stream* mal_init_stream;
+
+               if ((mal_init_buf = GDKmalloc(sizeof(buffer))) == NULL)
+                       throw(MAL, "malInclude", MAL_MALLOC_FAIL);
+               if ((mal_init_stream = buffer_rastream(mal_init_buf, name)) == 
NULL) {
+                       GDKfree(mal_init_buf);
+                       throw(MAL, "malInclude", MAL_MALLOC_FAIL);
+               }
                buffer_init(mal_init_buf, mal_init_inline, mal_init_len);
                c->srcFile = name;
                c->yycur = 0;
                c->bak = NULL;
-               c->fdin = bstream_create(mal_init_stream, mal_init_len);
+               if ((c->fdin = bstream_create(mal_init_stream, mal_init_len)) 
== NULL) {
+                       mnstr_destroy(mal_init_stream);
+                       GDKfree(mal_init_buf);
+                       throw(MAL, "malInclude", MAL_MALLOC_FAIL);
+               }
                bstream_next(c->fdin);
                parseMAL(c, c->curprg, 1, INT_MAX);
                free(mal_init_buf);
                free(mal_init_stream);
                free(c->fdin);
                c->fdin = NULL;
+               GDKfree(mal_init_buf);
        }
 #else
        if ((filename = malResolveFile(name)) != NULL) {
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -496,18 +496,28 @@ SQLinitClient(Client c)
                maybeupgrade = 0;
                {
                        size_t createdb_len = strlen(createdb_inline);
-                       buffer* createdb_buf = buffer_create(createdb_len);
-                       stream* createdb_stream = buffer_rastream(createdb_buf, 
"createdb.sql");
-                       bstream* createdb_bstream = 
bstream_create(createdb_stream, createdb_len);
+                       buffer* createdb_buf;
+                       stream* createdb_stream;
+                       bstream* createdb_bstream;
+                       if ((createdb_buf = GDKmalloc(sizeof(buffer))) == NULL)
+                               throw(MAL, "createdb", MAL_MALLOC_FAIL);
                        buffer_init(createdb_buf, createdb_inline, 
createdb_len);
+                       if ((createdb_stream = buffer_rastream(createdb_buf, 
"createdb.sql")) == NULL) {
+                               GDKfree(createdb_buf);
+                               throw(MAL, "createdb", MAL_MALLOC_FAIL);
+                       }
+                       if ((createdb_bstream = bstream_create(createdb_stream, 
createdb_len)) == NULL) {
+                               mnstr_destroy(createdb_stream);
+                               GDKfree(createdb_buf);
+                               throw(MAL, "createdb", MAL_MALLOC_FAIL);
+                       }
                        if (bstream_next(createdb_bstream) >= 0)
                                msg = SQLstatementIntern(c, 
&createdb_bstream->buf, "sql.init", TRUE, FALSE, NULL);
                        else
                                msg = createException(MAL, "createdb", 
SQLSTATE(42000) "Could not load inlined createdb script");
 
-                       free(createdb_buf);
-                       free(createdb_stream);
-                       free(createdb_bstream);
+                       bstream_destroy(createdb_bstream);
+                       GDKfree(createdb_buf);
                        if (m->sa)
                                sa_destroy(m->sa);
                        m->sa = NULL;
diff --git 
a/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.err
 
b/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.err
--- 
a/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.err
+++ 
b/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.err
@@ -31,10 +31,10 @@ stderr of test 'aggr_udf_with_more_than_
 
 MAPI  = (monetdb) /var/tmp/mtest-31488/.s.monetdb.35710
 QUERY = SELECT groupnr, aggr2(value) FROM grouped_ints GROUP BY groupnr;
-ERROR = !SELECT: no such aggregate 'aggr2' (int(32))
-MAPI  = (monetdb) /var/tmp/mtest-31488/.s.monetdb.35710
+ERROR = !SELECT: no such aggregate 'aggr2'
+MAPI  = (monetdb) /var/tmp/mtest-58752/.s.monetdb.37612
 QUERY = SELECT groupnr, aggr2(value, value, value) FROM grouped_ints GROUP BY 
groupnr;
-ERROR = !SELECT: no such aggregate 'aggr2' (int(32), int(32), int(32))
+ERROR = !SELECT: no such aggregate 'aggr2'
 
 # 16:36:13 >  
 # 16:36:13 >  "Done."
diff --git 
a/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.out
 
b/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.out
--- 
a/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.out
+++ 
b/sql/test/BugTracker-2017/Tests/aggr_udf_with_more_than_2params.Bug-6385.stable.out
@@ -94,15 +94,15 @@ Ready.
 #SELECT groupnr, aggr3(value, value, value) FROM grouped_ints GROUP BY groupnr;
 % sys.grouped_ints,    sys.L4 # table_name
 % groupnr,     L3 # name
-% int, int # type
-% 1,   1 # length
+% int, double # type
+% 1,   24 # length
 [ 0,   9       ]
 [ 1,   6       ]
 #SELECT groupnr, aggr4(value, value, value, value) FROM grouped_ints GROUP BY 
groupnr;
 % sys.grouped_ints,    sys.L4 # table_name
 % groupnr,     L3 # name
-% int, int # type
-% 1,   1 # length
+% int, double # type
+% 1,   24 # length
 [ 0,   9       ]
 [ 1,   6       ]
 #DROP TABLE grouped_ints;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to