From 03996f23159710c58ac2131034303412af64ed6b Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Tue, 6 Apr 2010 10:18:37 -0400 Subject: client/nastapi: Fix memory check when allocating string storage. --- client/nastapi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/nastapi.c b/client/nastapi.c index b6c14f0..82bdaee 100644 --- a/client/nastapi.c +++ b/client/nastapi.c @@ -35,8 +35,10 @@ nast_string_new(int slen, const char *data) return NULL; tmp->strdata = malloc((slen+1) * sizeof(char *)); - if (tmp == NULL) + if (tmp->strdata == NULL) { + free(tmp); return NULL; + } memcpy(tmp->strdata, data, slen); tmp->strdata[slen] = '\0'; tmp->strlen = slen; -- cgit v1.2.3