diff options
| author | Karsten Weiss <knweiss@gmail.com> | 2008-11-05 09:26:44 -0500 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2008-11-06 16:49:05 -0500 |
| commit | 061f742a28799eef8e7fe204fe3f7b0541b7f6c9 (patch) | |
| tree | 5aa3be10ade4a54181f2ba7830578e25e3c678a3 | |
| parent | c94081aa453c6c903c3c3c7ceab9cfe0efe0a406 (diff) | |
| download | man-pages-061f742a28799eef8e7fe204fe3f7b0541b7f6c9.tar.gz | |
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>
| -rw-r--r-- | man3/pthread_create.3 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/man3/pthread_create.3 b/man3/pthread_create.3 index 20ddda94cc..2b63462522 100644 --- a/man3/pthread_create.3 +++ b/man3/pthread_create.3 @@ -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"); |
