Module Name:    src
Committed By:   msaitoh
Date:           Fri Nov  9 06:27:17 UTC 2012

Modified Files:
        src/sbin/init: init.c

Log Message:
Add missing free() in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sbin/init/init.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/init/init.c
diff -u src/sbin/init/init.c:1.104 src/sbin/init/init.c:1.105
--- src/sbin/init/init.c:1.104	Sun Nov  4 22:20:03 2012
+++ src/sbin/init/init.c	Fri Nov  9 06:27:17 2012
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #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 @@ new_session(session_t *sprev, int sessio
 	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);

Reply via email to