Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt CID 1125874: Fix memory leak



details:   https://anonhg.NetBSD.org/src/rev/40770081f534
branches:  trunk
changeset: 791335:40770081f534
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 13 21:25:40 2013 +0000

description:
CID 1125874: Fix memory leak

diffstat:

 sbin/gpt/migrate.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 7592b49b2003 -r 40770081f534 sbin/gpt/migrate.c
--- a/sbin/gpt/migrate.c        Wed Nov 13 21:22:46 2013 +0000
+++ b/sbin/gpt/migrate.c        Wed Nov 13 21:25:40 2013 +0000
@@ -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 @@
            le32toh(dl->d_magic2) != DISKMAGIC) {
                warnx("%s: warning: FreeBSD slice without disklabel",
                    device_name);
+               free(buf);
                return (ent);
        }
 
@@ -153,6 +154,7 @@
                ent++;
        }
 
+       free(buf);
        return (ent);
 }
 
@@ -171,6 +173,7 @@
            le32toh(dl->d_magic2) != DISKMAGIC) {
                warnx("%s: warning: NetBSD slice without disklabel",
                    device_name);
+               free(buf);
                return (ent);
        }
 
@@ -247,6 +250,7 @@
                ent++;
        }
 
+       free(buf);
        return (ent);
 }
 



Home | Main Index | Thread Index | Old Index