diff options
-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; |