mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 13:24:43 -04:00
Stop too many bytes for activequeues.
We were saying calloc(N,N*sizeof(struct event_list*)) when we should have been saying calloc(N,sizeof(struct event_list*)). This wasted N*(N-1) words of memory, where N was the number of priorities. This wouldn't be a big deal for any sane number of priorities, but it's a bug nonetheless. svn:r1526
This commit is contained in:
parent
e32d055b5e
commit
b4183c732e
@ -5,6 +5,7 @@ Changes in 1.4.13-stable:
|
||||
o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
|
||||
o Rename our replacement compat/sys/_time.h header to avoid build a conflict on HPUX; reported by Kathryn Hogg.
|
||||
o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
|
||||
o Fix a problem with excessive memory allocation when using multiple event priorities.
|
||||
|
||||
|
||||
Changes in 1.4.12-stable:
|
||||
|
4
event.c
4
event.c
@ -326,8 +326,8 @@ event_base_priority_init(struct event_base *base, int npriorities)
|
||||
|
||||
/* Allocate our priority queues */
|
||||
base->nactivequeues = npriorities;
|
||||
base->activequeues = (struct event_list **)calloc(base->nactivequeues,
|
||||
npriorities * sizeof(struct event_list *));
|
||||
base->activequeues = (struct event_list **)
|
||||
calloc(base->nactivequeues, sizeof(struct event_list *));
|
||||
if (base->activequeues == NULL)
|
||||
event_err(1, "%s: calloc", __func__);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user