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
This commit is contained in:
Jacques Vidrine 2003-04-21 15:44:25 +00:00
parent 6625036082
commit 905ec0db3b

View File

@ -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); \