2e62326ad1cd024a471b93938a0e55b4dc218d20 jcasper Fri Aug 23 17:29:20 2013 -0700 Fixed small memory leak diff --git src/hg/lib/sqlProg.c src/hg/lib/sqlProg.c index 067b0fa..a751004 100644 --- src/hg/lib/sqlProg.c +++ src/hg/lib/sqlProg.c @@ -20,32 +20,36 @@ continue; return i; } } void copyCnfToDefaultsFile(char *path, char *defaultFileName, int fileNo) /* write the contents of the path to the fileNo */ { if (fileExists(path)) { char *cnf = NULL; size_t cnfSize = 0; readInGulp(path, &cnf, &cnfSize); if (write (fileNo, cnf, cnfSize) == -1) + { + freeMem(cnf); errAbort("Writing %s to file %s failed with errno %d", path, defaultFileName, errno); } + freeMem(cnf); + } } int sqlMakeDefaultsFile(char* defaultFileName, char* profile, char* group) /* Create a temporary file in the supplied directory to be passed to * mysql with --defaults-file. Writes a mysql options set for * the mysql group [group] with the profile.host, profile.user, and * profile.password values returned from cfgVal(). If group is not * client or mysql, a --defaults-group-suffix=group must be passed to * mysql to actually invoke the settings. * passFileName cannot be static, and the last 6 characters must * be XXXXXX. Those characters will be modified to form a unique suffix. * Returns a file descriptor for the file or dies with an error */ { int fileNo;