mirror of https://github.com/mkerrisk/man-pages
pthread_create.3: Fix bug in EXAMPLE program
The bug is in this part of the code: /* Allocate memory for pthread_create() arguments */ tinfo = calloc(num_threads, num_threads); if (tinfo == NULL) errExit("calloc"); The calloc() line should read like this instead: tinfo = calloc(num_threads, sizeof(struct thread_info)); Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
c94081aa45
commit
061f742a28
|
@ -21,7 +21,7 @@
|
|||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\"
|
||||
.TH PTHREAD_CREATE 3 2008-10-24 "Linux" "Linux Programmer's Manual"
|
||||
.TH PTHREAD_CREATE 3 2008-11-05 "Linux" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
pthread_create \- create a new thread
|
||||
.SH SYNOPSIS
|
||||
|
@ -317,7 +317,7 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Allocate memory for pthread_create() arguments */
|
||||
|
||||
tinfo = calloc(num_threads, num_threads);
|
||||
tinfo = calloc(num_threads, sizeof(struct thread_info));
|
||||
if (tinfo == NULL)
|
||||
errExit("calloc");
|
||||
|
||||
|
|
Loading…
Reference in New Issue