Add missing free() in error path.

This commit is contained in:
msaitoh 2012-11-09 06:27:17 +00:00
parent 8ff87897e6
commit b6620403e7

View File

@ -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, 1993\
#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 session_index, struct ttyent *typ)
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);