Fix Coverity issue 2281, resource leak, function return without freeing
dynamically allocated storage.
This commit is contained in:
parent
11f7fb17d4
commit
f44127c4ef
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getnetnamadr.c,v 1.32 2005/06/01 05:19:21 lukem Exp $ */
|
||||
/* $NetBSD: getnetnamadr.c,v 1.33 2006/03/17 15:53:29 ginsbach Exp $ */
|
||||
|
||||
/* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
|
||||
* Dep. Matematica Universidade de Coimbra, Portugal, Europe
|
||||
|
@ -43,7 +43,7 @@ static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 6/4/93";
|
|||
static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
|
||||
static char rcsid[] = "Id: getnetnamadr.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
|
||||
#else
|
||||
__RCSID("$NetBSD: getnetnamadr.c,v 1.32 2005/06/01 05:19:21 lukem Exp $");
|
||||
__RCSID("$NetBSD: getnetnamadr.c,v 1.33 2006/03/17 15:53:29 ginsbach Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -426,8 +426,10 @@ _dns_getnetbyname(void *rv, void *cb_data, va_list ap)
|
|||
return NS_NOTFOUND;
|
||||
}
|
||||
res = __res_get_state();
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
free(buf);
|
||||
return NS_NOTFOUND;
|
||||
}
|
||||
anslen = res_nsearch(res, qbuf, C_IN, T_PTR, buf->buf,
|
||||
sizeof(buf->buf));
|
||||
if (anslen < 0) {
|
||||
|
|
Loading…
Reference in New Issue