fix a serious bug in libproc's proc_attach

proc_attach always frees any struct proc_handle data
that it allocates, but that is supposed to be done
only in error conditions.

PR:		bin/158431
Approved by:	re (kib)
MFC after:	1 week
This commit is contained in:
Andriy Gapon 2011-08-03 09:55:59 +00:00
parent 52227d94df
commit a8375da0d3
1 changed files with 1 additions and 2 deletions

View File

@ -79,12 +79,11 @@ proc_attach(pid_t pid, int flags, struct proc_handle **pphdl)
else
phdl->status = PS_STOP;
out:
if (error)
proc_free(phdl);
else
*pphdl = phdl;
out:
proc_free(phdl);
return (error);
}