Fix use of freed memory in event_reinit; pointed out by Peter Postma

svn:r834
This commit is contained in:
Niels Provos 2008-05-16 01:55:40 +00:00
parent bc5e27190f
commit 134344b79e
3 changed files with 7 additions and 4 deletions

View File

@ -100,6 +100,7 @@ Changes in current version:
o provide a method for canceling ongoing http requests. o provide a method for canceling ongoing http requests.
o Make vsnprintf() returns consistent on win32. o Make vsnprintf() returns consistent on win32.
o Fix connection keep-alive behavior for HTTP/1.0 o Fix connection keep-alive behavior for HTTP/1.0
o Fix use of freed memory in event_reinit; pointed out by Peter Postma
Changes in 1.4.0: Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.

View File

@ -334,7 +334,7 @@ event_reinit(struct event_base *base)
if (base->evsel->dealloc != NULL) if (base->evsel->dealloc != NULL)
base->evsel->dealloc(base, base->evbase); base->evsel->dealloc(base, base->evbase);
base->evbase = evsel->init(base); evbase = base->evbase = evsel->init(base);
if (base->evbase == NULL) if (base->evbase == NULL)
event_errx(1, "%s: could not reinitialize event mechanism", event_errx(1, "%s: could not reinitialize event mechanism",
__func__); __func__);

View File

@ -499,12 +499,14 @@ test_fork(void)
exit(1); exit(1);
} }
called = 0;
event_dispatch(); event_dispatch();
/* we do not send an EOF; simple_read_cb requires an EOF /* we do not send an EOF; simple_read_cb requires an EOF
* to set test_ok. we just verify that the callback was * to set test_ok. we just verify that the callback was
* called. */ * called. */
exit(test_ok != 0 || called != 2); exit(test_ok != 0 || called != 2 ? -2 : 76);
} }
/* wait for the child to read the data */ /* wait for the child to read the data */
@ -517,8 +519,8 @@ test_fork(void)
exit(1); exit(1);
} }
if (WEXITSTATUS(status) != 0) { if (WEXITSTATUS(status) != 76) {
fprintf(stderr, "FAILED (exit)\n"); fprintf(stderr, "FAILED (exit): %d\n", WEXITSTATUS(status));
exit(1); exit(1);
} }