I was trying to run make check-devel on a sanitized build of R to
verify a bugfix and it kept failing due to leaks:

try(order(list(1,2))) leaks the 'isna' array before failing with
UNIMPLEMENTED_TYPE:
-----------------------------------8<-----------------------------------
Index: src/main/sort.c
===================================================================
--- src/main/sort.c     (revision 90482)
+++ src/main/sort.c     (working copy)
@@ -1193,6 +1193,7 @@
            for (i = 0; i < n; i++) isna[i] = ISNAN(cx[i].r) || ISNAN(cx[i].i);
            break;
        default:
+           R_Free(isna);
            UNIMPLEMENTED_TYPE("orderVector1", key);
        }
        for (i = 0; i < n; i++) numna += isna[i];
-----------------------------------8<-----------------------------------

echo hello | gzip -c > foo.gz
Rscript -e 'close(gzcon(file("foo.gz", "rb")))'
Leaks the underlying Rconnection struct that had been wrapped by gzcon:
-----------------------------------8<-----------------------------------
Index: src/main/connections.c
===================================================================
--- src/main/connections.c      (revision 90482)
+++ src/main/connections.c      (working copy)
@@ -4168,6 +4168,7 @@
        Rgzconn priv = con->private;
        con_close1(priv->con);
        R_ReleaseObject(priv->con->ex_ptr);
+       free(priv->con);
     }
     /* close inconv and outconv if open */
     if(con->inconv) Riconv_close(con->inconv);
-----------------------------------8<-----------------------------------

addTaskCallback(\(...) FALSE, name = "hello world") leaks the name of
the task callback:
-----------------------------------8<-----------------------------------
Index: src/main/main.c
===================================================================
--- src/main/main.c     (revision 90482)
+++ src/main/main.c     (working copy)
@@ -1893,6 +1893,7 @@
                Rf_ToplevelTaskHandlers = h;
            if(tmp->finalizer)
                tmp->finalizer(tmp->data);
+           free(tmp->name);
            free(tmp);
        }
     }
-----------------------------------8<-----------------------------------

Unfortunately, there are more.

-- 
Best regards,
Ivan

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to