Fix resource leak if malloc of tb->data failed.
Whitespace cleanup.
This commit is contained in:
parent
dbd04f2b27
commit
8426a88bc7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: termcap.c,v 1.48 2005/02/04 15:52:08 perry Exp $ */
|
||||
/* $NetBSD: termcap.c,v 1.49 2006/03/18 12:18:15 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: termcap.c,v 1.48 2005/02/04 15:52:08 perry Exp $");
|
||||
__RCSID("$NetBSD: termcap.c,v 1.49 2006/03/18 12:18:15 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -480,8 +480,11 @@ t_agetstr(struct tinfo *info, const char *id)
|
||||
if ((tb = malloc(sizeof(*info->tbuf))) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((tb->data = tb->ptr = tb->eptr = malloc(new_size)) == NULL)
|
||||
if ((tb->data = tb->ptr = tb->eptr = malloc(new_size))
|
||||
== NULL) {
|
||||
free(tb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tb->eptr += new_size;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user