svn commit: r276704 - head/usr.sbin/fstyp

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Jan 5 15:34:25 UTC 2015


Author: trasz
Date: Mon Jan  5 15:34:23 2015
New Revision: 276704
URL: https://svnweb.freebsd.org/changeset/base/276704

Log:
  Fix memory leaks.
  
  CID:	1258582, 1258583.
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/fstyp/ext2fs.c
  head/usr.sbin/fstyp/ntfs.c

Modified: head/usr.sbin/fstyp/ext2fs.c
==============================================================================
--- head/usr.sbin/fstyp/ext2fs.c	Mon Jan  5 15:29:28 2015	(r276703)
+++ head/usr.sbin/fstyp/ext2fs.c	Mon Jan  5 15:34:23 2015	(r276704)
@@ -85,6 +85,7 @@ fstyp_ext2fs(FILE *fp, char *label, size
 	}
 
 	strlcpy(label, s_volume_name, size);
+	free(fs);
 
 	return (0);
 }

Modified: head/usr.sbin/fstyp/ntfs.c
==============================================================================
--- head/usr.sbin/fstyp/ntfs.c	Mon Jan  5 15:29:28 2015	(r276703)
+++ head/usr.sbin/fstyp/ntfs.c	Mon Jan  5 15:34:23 2015	(r276704)
@@ -108,7 +108,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t
 
 	bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512);
 	if (bf == NULL || strncmp(bf->bf_sysid, "NTFS    ", 8) != 0)
-		return (1);
+		goto fail;
 
 	mftrecsz = bf->bf_mftrecsz;
 	recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz);


More information about the svn-src-head mailing list