Skip to content
Snippets Groups Projects
Commit 0201374f authored by Morris Jette's avatar Morris Jette
Browse files

Fix for memory leak

Coverity CID 179255
parent 83f66526
No related branches found
No related tags found
No related merge requests found
...@@ -268,14 +268,14 @@ int setenvf(char ***envp, const char *name, const char *fmt, ...) ...@@ -268,14 +268,14 @@ int setenvf(char ***envp, const char *name, const char *fmt, ...)
va_list ap; va_list ap;
int size, rc; int size, rc;
if (!name)
return EINVAL;
value = xmalloc(ENV_BUFSIZE); value = xmalloc(ENV_BUFSIZE);
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(value, ENV_BUFSIZE, fmt, ap); vsnprintf(value, ENV_BUFSIZE, fmt, ap);
va_end(ap); va_end(ap);
if (!name)
return EINVAL;
size = strlen(name) + strlen(value) + 2; size = strlen(name) + strlen(value) + 2;
if (size >= MAX_ENV_STRLEN) { if (size >= MAX_ENV_STRLEN) {
error("environment variable %s is too long", name); error("environment variable %s is too long", name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment