Changeset: 80b90e75f3fc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80b90e75f3fc
Modified Files:
        monetdb5/mal/mal_exception.c
Branch: Jul2021
Log Message:

Reduce number of thread get data calls and add defensive line for GDK error 
buffer existence


diffs (41 lines):

diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -121,27 +121,27 @@ str
 createException(enum malexception type, const char *fcn, const char *format, 
...)
 {
        va_list ap;
-       str ret = NULL;
+       str ret = NULL, localGDKerrbuf = GDKerrbuf;
 
-       if (GDKerrbuf &&
+       if (localGDKerrbuf &&
                (ret = strstr(format, MAL_MALLOC_FAIL)) != NULL &&
                ret[strlen(MAL_MALLOC_FAIL)] != ':' &&
-               (strncmp(GDKerrbuf, "GDKmalloc", 9) == 0 ||
-                strncmp(GDKerrbuf, "GDKrealloc", 10) == 0 ||
-                strncmp(GDKerrbuf, "GDKzalloc", 9) == 0 ||
-                strncmp(GDKerrbuf, "GDKstrdup", 9) == 0 ||
-                strncmp(GDKerrbuf, "allocating too much virtual address 
space", 41) == 0)) {
+               (strncmp(localGDKerrbuf, "GDKmalloc", 9) == 0 ||
+                strncmp(localGDKerrbuf, "GDKrealloc", 10) == 0 ||
+                strncmp(localGDKerrbuf, "GDKzalloc", 9) == 0 ||
+                strncmp(localGDKerrbuf, "GDKstrdup", 9) == 0 ||
+                strncmp(localGDKerrbuf, "allocating too much virtual address 
space", 41) == 0)) {
                /* override errors when the underlying error is memory
                 * exhaustion, but include whatever it is that the GDK level
                 * reported */
-               ret = createException(type, fcn, SQLSTATE(HY013) 
MAL_MALLOC_FAIL ": %s", GDKerrbuf);
+               ret = createException(type, fcn, SQLSTATE(HY013) 
MAL_MALLOC_FAIL ": %s", localGDKerrbuf);
                GDKclrerr();
                assert(ret);
                return ret;
        }
-       if (strcmp(format, GDK_EXCEPTION) == 0 && GDKerrbuf[0]) {
+       if (localGDKerrbuf && localGDKerrbuf[0] && strcmp(format, 
GDK_EXCEPTION) == 0) {
                /* for GDK errors, report the underlying error */
-               char *p = GDKerrbuf;
+               char *p = localGDKerrbuf;
                if (strncmp(p, GDKERROR, strlen(GDKERROR)) == 0) {
                        /* error is "!ERROR: function_name: STATE!error message"
                         * we need to skip everything up to the STATE */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to