mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
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:
parent
4837b29191
commit
d51f3e34b4
1 changed files with 6 additions and 8 deletions
|
|
@ -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 {
|
||||
|
|
@ -147,12 +151,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;
|
||||
}
|
||||
#endif // HAVE_GETMNTENT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue