>From 72d43756f09599da9d0907c9f62c6a8e1e0cb261 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 19 Nov 2013 08:40:00 +0530 Subject: [PATCH] __nc_error() does not check return value from malloc Signed-off-by: Susant Sahani --- src/getnetconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/getnetconfig.c b/src/getnetconfig.c index af4a484..2460a6e 100644 --- a/src/getnetconfig.c +++ b/src/getnetconfig.c @@ -146,7 +146,8 @@ __nc_error() return (&nc_error); } if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) { - nc_addr = (int *)malloc(sizeof (int)); + if((nc_addr = (int *)malloc(sizeof (int))) == NULL) + return (&nc_error); if (thr_setspecific(nc_key, (void *) nc_addr) != 0) { if (nc_addr) free(nc_addr); -- 1.8.4.2