Changeset: 55a75e48e3fc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=55a75e48e3fc
Modified Files:
        monetdb5/mal/mal_profiler.c
Branch: Jul2017
Log Message:

Error handling in case we cannot allocate strings

Part of the fix for bug 6375


diffs (63 lines):

diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -281,7 +281,7 @@ renderProfilerEvent(MalBlkPtr mb, MalStk
 #else
                logadd("\"prereq\":%s]%s", prereq, prettify);
 #endif
-               
+
 /* EXAMPLE MAL statement argument decomposition
  * The eventparser may assume this layout for ease of parsing
 {
@@ -307,14 +307,14 @@ This information can be used to determin
 
                                if( j == pci->retc ){
                                        logadd("],%s\"arg\":[",prettify);
-                               } 
+                               }
                                logadd("{");
                                logadd("\"index\":\"%d\",%s", j,pret);
                                logadd("\"name\":\"%s\",%s", getVarName(mb, 
getArg(pci,j)), pret);
                                if( getVarSTC(mb,getArg(pci,j))){
                                        InstrPtr stc = getInstrPtr(mb, 
getVarSTC(mb,getArg(pci,j)));
                                        if(stc && 
strcmp(getModuleId(stc),"sql") ==0  && strncmp(getFunctionId(stc),"bind",4)==0)
-                                               
logadd("\"alias\":\"%s.%s.%s\",%s", 
+                                               
logadd("\"alias\":\"%s.%s.%s\",%s",
                                                        getVarConstant(mb, 
getArg(stc,stc->retc +1)).val.sval,
                                                        getVarConstant(mb, 
getArg(stc,stc->retc +2)).val.sval,
                                                        getVarConstant(mb, 
getArg(stc,stc->retc +3)).val.sval, pret);
@@ -336,16 +336,16 @@ This information can be used to determin
                                                } else
                                                        
logadd("\"kind\":\"%s\",%s", ( d->batPersistence == PERSISTENT ? 
"persistent":"transient"), pret);
                                                total += cnt * d->twidth;
-                                               total += heapinfo(d->tvheap, 
d->batCacheid); 
-                                               total += hashinfo(d->thash, 
d->batCacheid); 
+                                               total += heapinfo(d->tvheap, 
d->batCacheid);
+                                               total += hashinfo(d->thash, 
d->batCacheid);
                                                total += IMPSimprintsize(d);
                                                BBPunfix(d->batCacheid);
-                                       } 
+                                       }
                                        logadd("\"bid\":\"%d\",%s", bid,pret);
                                        
logadd("\"count\":\""BUNFMT"\",%s",cnt,pret);
                                        logadd("\"size\":" LLFMT",%s", 
total,pret);
                                } else{
-                                       char *truncated;
+                                       char *truncated = NULL;
                                        tname = getTypeName(tpe);
                                        logadd("\"type\":\"%s\",%s", 
tname,pret);
                                        cv = 0;
@@ -356,7 +356,11 @@ This information can be used to determin
                                                GDKfree(stmtq);
                                                stmtq = truncated;
                                        }
-                                       logadd("\"value\":\"%s\",%s", 
stmtq,pret);
+                                       if (stmtq == NULL) {
+                                               
logadd("\"value\":\"(null)\",%s", pret);
+                                       } else {
+                                               logadd("\"value\":\"%s\",%s", 
stmtq, pret);
+                                       }
                                        GDKfree(cv);
                                        GDKfree(stmtq);
                                }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to