Commit 4eeabcad authored by Pekka Pessi's avatar Pekka Pessi

su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes)

darcs-hash:20071023144517-65a35-f775ca9f300e07d6ad6fbd8c16f4612fa5c5eafc.gz
parent c81c3c16
......@@ -915,6 +915,11 @@ void su_home_destroy(su_home_t *home)
* @retval -1 upon an error.
*
* @sa SU_HOME_INIT(), su_home_deinit(), su_home_new(), su_home_clone()
*
* @bug
* Prior to @VERSION_1_12_8 the su_home_t structure should have been
* initialized with SU_HOME_INIT() or otherwise zeroed before calling
* su_home_init().
*/
int su_home_init(su_home_t *home)
{
......@@ -924,6 +929,8 @@ int su_home_init(su_home_t *home)
return -1;
home->suh_blocks = sub = su_hash_alloc(SUB_N);
home->suh_lock = NULL;
if (!sub)
return -1;
......
......@@ -69,6 +69,7 @@ static int test_alloc(void)
{
exhome_t *h0, *h1, *h2, *h3;
su_home_t home[1] = { SU_HOME_INIT(home) };
su_home_t home0[1];
enum { N = 40 };
void *m0[N], *m1[N], *m;
char *c, *c0, *p0, *p1;
......@@ -78,6 +79,11 @@ static int test_alloc(void)
BEGIN();
/* su_home_init() was not initializing suh_locks */
memset(home0, 0xff, sizeof home0);
TEST(su_home_init(home0), 0);
TEST_VOID(su_home_deinit(home0));
TEST_1(h0 = su_home_new(sizeof(*h0)));
TEST_1(h1 = su_home_clone(h0->home, sizeof(*h1)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment