Changeset: c90763543b95 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c90763543b95
Modified Files:
        sql/storage/store.c
Branch: Apr2019
Log Message:

Allocation check in store_load.


diffs (35 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1749,14 +1749,18 @@ store_load(void) {
 
        if (first) {
                /* cannot initialize database in readonly mode */
-               if (store_readonly) {
+               if (store_readonly)
+                       return -1;
+               tr = sql_trans_create(backend_stk, NULL, NULL);
+               if (!tr) {
+                       fprintf(stderr, "Failure to start a transaction while 
loading the storage\n");
                        return -1;
                }
-               tr = sql_trans_create(backend_stk, NULL, NULL);
-               if(!tr)
+       } else {
+               if (!(store_oids = GDKzalloc(300 * sizeof(sqlid)))) { /* 150 
suffices */
+                       fprintf(stderr, "Allocation failure while loading the 
storage\n");
                        return -1;
-       } else {
-               store_oids = GDKzalloc(300 * sizeof(sqlid)); /* 150 suffices */
+               }
        }
 
        s = bootstrap_create_schema(tr, "sys", ROLE_SYSADMIN, USER_MONETDB);
@@ -1944,7 +1948,6 @@ store_load(void) {
 int
 store_init(int debug, store_type store, int readonly, int singleuser, 
backend_stack stk)
 {
-
        int v = 1;
 
        backend_stk = stk;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to