expression parser: Fix (theoretical) memory leak.

Fix a memory leak that is very unlikely to actually happen.  If a malloc()
succeeded, but the following strdup() failed, the memory from the original
malloc() would be leaked.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@360356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2012-03-24 02:33:36 +00:00
parent c04afdbc70
commit 17cd5abb22

View File

@@ -532,6 +532,9 @@ make_str (const char *s)
vp = (struct val *) malloc (sizeof (*vp)); vp = (struct val *) malloc (sizeof (*vp));
if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) { if (vp == NULL || ((vp->u.s = strdup (s)) == NULL)) {
if (vp) {
free(vp);
}
ast_log(LOG_WARNING,"malloc() failed\n"); ast_log(LOG_WARNING,"malloc() failed\n");
return(NULL); return(NULL);
} }