Pithikos / C-Thread-Pool

A minimal but powerful thread pool in ANSI C
MIT License
2.06k stars 603 forks source link

Malloc-ing more than needed memory #21

Closed fushijian closed 8 years ago

fushijian commented 9 years ago

the code in thpool.c at 143 lines is as blow: thpool_p->threads = (struct thread*)malloc(num_threads \ sizeof(struct thread));

i think it shuold be
thpool_p->threads = (struct thread*)malloc(num_threads * sizeof(struct thread ));

Pithikos commented 9 years ago

Nice catch! This definitely is a bug.

boxerab commented 8 years ago

+1 for merging this fix into master