complete the do-not-free-data-from-getmntinfo() fix

git-svn-id: svn://localhost/ardour2/branches/3.0@11232 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-01-11 18:14:18 +00:00
parent 4837b29191
commit d51f3e34b4

View File

@ -110,8 +110,13 @@ mountpoint (string path)
const char *cpath = path.c_str();
char best[PATH_MAX+1];
/* From the manpage, under "BUGS" : "The memory allocated by getmntinfo() cannot be free(3)'d by the
application."
Thus: we do NOT try to free memory allocated by getmntinfo()
*/
if ((count = getmntinfo(&mntbufp, MNT_NOWAIT)) == 0) {
free(mntbufp);
return "\0";
}
@ -135,7 +140,6 @@ mountpoint (string path)
if (cpath[matchlen] == '\0') {
snprintf(best, sizeof(best), "%s", mntbufp[i].f_mntonname);
free(mntbufp);
return best;
} else {
@ -146,12 +150,6 @@ mountpoint (string path)
}
}
}
/* From the manpage, under "BUGS" : "The memory allocated by getmntinfo() cannot be free(3)'d by the
application."
free(mntbufp);
*/
return best;
}