diff options
author | nectar <nectar@FreeBSD.org> | 2003-04-21 15:44:25 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2003-04-21 15:44:25 +0000 |
commit | bba483a33ae2081fd6df5266da909552b5bb2ab7 (patch) | |
tree | 9f98869610b0497a005ce7b70e89188cc32ae61c /lib/libc | |
parent | d06885c524f36a20f1359e0ad9fc4df54882c6c4 (diff) | |
download | FreeBSD-src-bba483a33ae2081fd6df5266da909552b5bb2ab7.zip FreeBSD-src-bba483a33ae2081fd6df5266da909552b5bb2ab7.tar.gz |
Correct a bug that was somehow both obvious and hard-to-see. :-)
An incorrectly-sized allocation was being made due to an incorrect
argument to the `sizeof' operator. Obvious, because it violated the
`foo = malloc(sizeof(*foo))' idiom. Hard-to-see, because it was a
missing `*' (`*p' versus `**p').
Resulting failure was
Reported by: ache
Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/include/nss_tls.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/include/nss_tls.h b/lib/libc/include/nss_tls.h index be6b74f..999d198 100644 --- a/lib/libc/include/nss_tls.h +++ b/lib/libc/include/nss_tls.h @@ -64,7 +64,7 @@ name##_getstate(struct name##_state **p) \ *p = _pthread_getspecific(name##_state_key); \ if (*p != NULL) \ return (0); \ - *p = calloc(1, sizeof(*p)); \ + *p = calloc(1, sizeof(**p)); \ if (*p == NULL) \ return (ENOMEM); \ rv = _pthread_setspecific(name##_state_key, *p); \ |