mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Remove unwanted malloc changes, again.
This commit is contained in:
@ -4852,8 +4852,7 @@ _int_free(mstate av, mchunkptr p)
|
|||||||
free_perturb (chunk2mem(p), size - SIZE_SZ);
|
free_perturb (chunk2mem(p), size - SIZE_SZ);
|
||||||
|
|
||||||
set_fastchunks(av);
|
set_fastchunks(av);
|
||||||
unsigned int idx = fastbin_index(size);
|
fb = &fastbin (av, fastbin_index(size));
|
||||||
fb = &fastbin (av, idx);
|
|
||||||
|
|
||||||
#ifdef ATOMIC_FASTBINS
|
#ifdef ATOMIC_FASTBINS
|
||||||
mchunkptr fd;
|
mchunkptr fd;
|
||||||
@ -4867,12 +4866,6 @@ _int_free(mstate av, mchunkptr p)
|
|||||||
errstr = "double free or corruption (fasttop)";
|
errstr = "double free or corruption (fasttop)";
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
if (old != NULL
|
|
||||||
&& __builtin_expect (fastbin_index(chunksize(old)) != idx, 0))
|
|
||||||
{
|
|
||||||
errstr = "invalid fastbin entry (free)";
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
p->fd = fd = old;
|
p->fd = fd = old;
|
||||||
}
|
}
|
||||||
while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
|
while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
|
||||||
@ -4884,12 +4877,6 @@ _int_free(mstate av, mchunkptr p)
|
|||||||
errstr = "double free or corruption (fasttop)";
|
errstr = "double free or corruption (fasttop)";
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
if (*fb != NULL
|
|
||||||
&& __builtin_expect (fastbin_index(chunksize(*fb)) != idx, 0))
|
|
||||||
{
|
|
||||||
errstr = "invalid fastbin entry (free)";
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->fd = *fb;
|
p->fd = *fb;
|
||||||
*fb = p;
|
*fb = p;
|
||||||
|
@ -51,7 +51,6 @@ main (void)
|
|||||||
|
|
||||||
for (i=0; i<100; ++i)
|
for (i=0; i<100; ++i)
|
||||||
{
|
{
|
||||||
printf("round %li\n", i);
|
|
||||||
save_state = malloc_get_state ();
|
save_state = malloc_get_state ();
|
||||||
if (save_state == NULL)
|
if (save_state == NULL)
|
||||||
{
|
{
|
||||||
@ -65,18 +64,13 @@ printf("round %li\n", i);
|
|||||||
merror ("realloc (i*4) failed.");
|
merror ("realloc (i*4) failed.");
|
||||||
free (save_state);
|
free (save_state);
|
||||||
}
|
}
|
||||||
puts("done");
|
|
||||||
|
|
||||||
p1 = realloc (p1, 40);
|
p1 = realloc (p1, 40);
|
||||||
puts("after realloc");
|
|
||||||
free (p2);
|
free (p2);
|
||||||
puts("after free 1");
|
|
||||||
p2 = malloc (10);
|
p2 = malloc (10);
|
||||||
puts("after malloc");
|
|
||||||
if (p2 == NULL)
|
if (p2 == NULL)
|
||||||
merror ("malloc (10) failed.");
|
merror ("malloc (10) failed.");
|
||||||
free (p1);
|
free (p1);
|
||||||
puts("after free 2");
|
|
||||||
|
|
||||||
return errors != 0;
|
return errors != 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user