So this wasn't tested for a month? Anyways, Free() is just free() with a check that we're not freeing a null pointer, followed by setting the pointer to NULL. At that point of tcltk.c, we have
for (objc = i = 0; i < length(avec); i++){ const char *s; char *tmp; if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){ // tmp = calloc(strlen(s)+2, sizeof(char)); tmp = Calloc(strlen(s)+2, char); *tmp = '-'; strcpy(tmp+1, s); objv[objc++] = Tcl_NewStringObj(tmp, -1); free(tmp); } if (!isNull(t = VECTOR_ELT(avec, i))) objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); } and I can't see how tmp can be NULL at the free(), nor can I see it mattering if it is not set to NULL (notice that it goes out of scope with the for loop). -pd > On 7 Jun 2020, at 16:00 , Jeroen Ooms <jeroeno...@gmail.com> wrote: > > On Sun, Jun 7, 2020 at 3:13 AM Fox, John <j...@mcmaster.ca> wrote: >> >> Hi, >> >> The following code, from the examples in ?TkWidgets , immediately crashes R >> 4.0.1 for Windows: >> >> --------------------- snip -------------------- >> library("tcltk") >> tt <- tktoplevel() >> label.widget <- tklabel(tt, text = "Hello, World!") >> button.widget <- tkbutton(tt, text = "Push", >> command = function()cat("OW!\n")) >> tkpack(label.widget, button.widget) # geometry manager >> --------------------- snip -------------------- > > > I can reproduce this. The backtrace shows the crash happens in > dotTclObjv [/src/library/tcltk/src/tcltk.c@243 ]. This looks like a > bug that was introduced by commit 78408/78409 about a month ago. I > think the problem is that this commit changes 'calloc' to 'Calloc' > without changing the corresponding 'free' to 'Free'. > > This has nothing to do with the Windows build or installation. Nothing > has changed in the windows build procedure between 4.0.0 and 4.0.1. > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel