Module Name:    src
Committed By:   christos
Date:           Wed Nov 13 21:25:40 UTC 2013

Modified Files:
        src/sbin/gpt: migrate.c

Log Message:
CID 1125874: Fix memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/gpt/migrate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/migrate.c
diff -u src/sbin/gpt/migrate.c:1.11 src/sbin/gpt/migrate.c:1.12
--- src/sbin/gpt/migrate.c:1.11	Tue Oct 22 03:30:20 2013
+++ src/sbin/gpt/migrate.c	Wed Nov 13 16:25:40 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.11 2013/10/22 07:30:20 jnemeth Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.12 2013/11/13 21:25:40 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -91,6 +91,7 @@ migrate_disklabel(int fd, off_t start, s
 	    le32toh(dl->d_magic2) != DISKMAGIC) {
 		warnx("%s: warning: FreeBSD slice without disklabel",
 		    device_name);
+		free(buf);
 		return (ent);
 	}
 
@@ -153,6 +154,7 @@ migrate_disklabel(int fd, off_t start, s
 		ent++;
 	}
 
+	free(buf);
 	return (ent);
 }
 
@@ -171,6 +173,7 @@ migrate_netbsd_disklabel(int fd, off_t s
 	    le32toh(dl->d_magic2) != DISKMAGIC) {
 		warnx("%s: warning: NetBSD slice without disklabel",
 		    device_name);
+		free(buf);
 		return (ent);
 	}
 
@@ -247,6 +250,7 @@ migrate_netbsd_disklabel(int fd, off_t s
 		ent++;
 	}
 
+	free(buf);
 	return (ent);
 }
 

Reply via email to