Fix memory leak on error.

Found with:	Coverity Prevent(tm)
MFC after:	1 month
This commit is contained in:
Fabien Thomas 2010-06-05 23:00:02 +00:00
parent 73dd1f4339
commit d66caf62a2

View File

@ -549,8 +549,10 @@ pmclog_open(int fd)
/* allocate space for a work area */
if (ps->ps_fd != PMCLOG_FD_NONE) {
if ((ps->ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL)
if ((ps->ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL) {
free(ps);
return NULL;
}
}
return ps;