diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-11 18:14:18 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-11 18:14:18 +0000 |
commit | d51f3e34b4b9aecb62fa3ecaca9d0ac298ef511c (patch) | |
tree | e6df4e28744174c8acfb4ebde74206ccf1bd936d /libs/pbd/mountpoint.cc | |
parent | 4837b29191ffcb369def3fe6923461a9dcb87cb4 (diff) |
complete the do-not-free-data-from-getmntinfo() fix
git-svn-id: svn://localhost/ardour2/branches/3.0@11232 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/mountpoint.cc')
-rw-r--r-- | libs/pbd/mountpoint.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc index 045e815282..46cea42e0a 100644 --- a/libs/pbd/mountpoint.cc +++ b/libs/pbd/mountpoint.cc @@ -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; } |