Source-Changes-HG archive

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

[src/trunk]: src/sbin/init Add missing free() in error path.



details:   https://anonhg.NetBSD.org/src/rev/d03d3f7c6707
branches:  trunk
changeset: 782615:d03d3f7c6707
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Nov 09 06:27:17 2012 +0000

description:
Add missing free() in error path.

diffstat:

 sbin/init/init.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 55937689d26f -r d03d3f7c6707 sbin/init/init.c
--- a/sbin/init/init.c  Fri Nov 09 04:43:25 2012 +0000
+++ b/sbin/init/init.c  Fri Nov 09 06:27:17 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.104 2012/11/04 22:20:03 christos Exp $      */
+/*     $NetBSD: init.c,v 1.105 2012/11/09 06:27:17 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)init.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: init.c,v 1.104 2012/11/04 22:20:03 christos Exp $");
+__RCSID("$NetBSD: init.c,v 1.105 2012/11/09 06:27:17 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -1103,8 +1103,10 @@
        sp->se_index = session_index;
 
        (void)asprintf(&sp->se_device, "%s%s", _PATH_DEV, typ->ty_name);
-       if (!sp->se_device)
+       if (!sp->se_device) {
+               free(sp);
                return NULL;
+       }
 
        if (setupargv(sp, typ) == 0) {
                free_session(sp);



Home | Main Index | Thread Index | Old Index