diff options
author | Brian Cully <bjc@kublai.com> | 2010-04-06 10:18:37 -0400 |
---|---|---|
committer | Brian Cully <github.20.shmit@spamgourmet.com> | 2010-04-06 10:18:37 -0400 |
commit | 03996f23159710c58ac2131034303412af64ed6b (patch) | |
tree | 0b514a3b58cb40415b23612047c30e7a86cd7225 /client | |
parent | 3d0382d6c525a5457a677464c6ad3561ee372cea (diff) | |
download | nastd-03996f23159710c58ac2131034303412af64ed6b.tar.gz nastd-03996f23159710c58ac2131034303412af64ed6b.zip |
client/nastapi: Fix memory check when allocating string storage.
Diffstat (limited to 'client')
-rw-r--r-- | client/nastapi.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |