summaryrefslogtreecommitdiffstats
path: root/usr.bin/fstat
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2003-09-23 16:44:17 +0000
committerfjoe <fjoe@FreeBSD.org>2003-09-23 16:44:17 +0000
commit655247e0f5d689da4bda90e946a5227f58670ef2 (patch)
tree50b65605f93859e05d0cc1ecba02a8422a2dc0af /usr.bin/fstat
parent3d68723716bfa0987b31777ec7ab2c4cb4bd7030 (diff)
downloadFreeBSD-src-655247e0f5d689da4bda90e946a5227f58670ef2.zip
FreeBSD-src-655247e0f5d689da4bda90e946a5227f58670ef2.tar.gz
Do not cache and correctly free() dosmount entry in case of errors.
PR: 53980 (partially)
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r--usr.bin/fstat/msdosfs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/fstat/msdosfs.c b/usr.bin/fstat/msdosfs.c
index 6766677..dda7d17 100644
--- a/usr.bin/fstat/msdosfs.c
+++ b/usr.bin/fstat/msdosfs.c
@@ -100,15 +100,16 @@ msdosfs_filestat(vp, fsp)
if (!mnt) {
if ((mnt = malloc(sizeof(struct dosmount))) == NULL)
err(1, NULL);
- mnt->next = mounts;
- mounts = mnt;
- mnt->kptr = denode.de_pmp;
if (!KVM_READ(denode.de_pmp, &mnt->data, sizeof mnt->data)) {
+ free(mnt);
dprintf(stderr,
"can't read mount info at %p for pid %d\n",
(void *)denode.de_pmp, Pid);
return 0;
}
+ mnt->next = mounts;
+ mounts = mnt;
+ mnt->kptr = denode.de_pmp;
}
fsp->fsid = dev2udev(denode.de_dev);
OpenPOWER on IntegriCloud