[argyllcms] Memory leak in xdg_bds.c

  • From: Ian <pb23@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Sat, 14 Apr 2012 05:46:32 +0100

There's also a memory leak in xdg_bds(). The function xdg_ifree() doesn't clean up properly.


Ian

/* Do internal cleanup */
static void xdg_ifree(char ***paths, char **fnames, int nopaths) {
    int i;

    if (paths != NULL) {
        if (*paths != NULL) {
            for (i = 0; i < nopaths; i++) {
                if ((*paths)[i] != NULL)
                    free ((*paths)[i]);
            }
        }
        free(*paths);
        *paths = NULL;
    }
    if (fnames != NULL) {
        for (i = 0; i < nopaths; i++) {
            if (fnames[i] != NULL)
                free (fnames[i]);
        }
free(fnames); // The memory allocated for fnames itself needs to be freed here
    }
}

Other related posts:

  • » [argyllcms] Memory leak in xdg_bds.c - Ian