mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-28 21:07:55 +00:00
store_iobuf_local: fix potential double free on the error path.
This commit is contained in:
parent
3b6f620e3e
commit
3c1ce4bf72
@ -559,7 +559,6 @@ store_iobuf_local(int iofd, IoBuffer *iobuf, uint8_t *buf, size_t buflen,
|
|||||||
errstr);
|
errstr);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
free(newbuf);
|
|
||||||
|
|
||||||
/* Write timing data. */
|
/* Write timing data. */
|
||||||
if (!iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
|
if (!iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
|
||||||
@ -575,12 +574,14 @@ store_iobuf_local(int iofd, IoBuffer *iobuf, uint8_t *buf, size_t buflen,
|
|||||||
if (random_drop > 0.0) {
|
if (random_drop > 0.0) {
|
||||||
double randval = arc4random() / (double)UINT32_MAX;
|
double randval = arc4random() / (double)UINT32_MAX;
|
||||||
if (randval < random_drop) {
|
if (randval < random_drop) {
|
||||||
|
closure->errstr = _("randomly dropping connection");
|
||||||
sudo_debug_printf(SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO,
|
sudo_debug_printf(SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO,
|
||||||
"randomly dropping connection (%f < %f)", randval, random_drop);
|
"randomly dropping connection (%f < %f)", randval, random_drop);
|
||||||
debug_return_bool(false);
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(newbuf);
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
bad:
|
bad:
|
||||||
free(newbuf);
|
free(newbuf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user