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
|
* Copyright (c) 1980, 1993
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#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
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -480,8 +480,11 @@ t_agetstr(struct tinfo *info, const char *id)
|
||||||
if ((tb = malloc(sizeof(*info->tbuf))) == NULL)
|
if ((tb = malloc(sizeof(*info->tbuf))) == NULL)
|
||||||
return 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;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tb->eptr += new_size;
|
tb->eptr += new_size;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue