Skip to content

Commit

Permalink
kernel/mem/mem/mem02: Remove invalid assumptions.
Browse files Browse the repository at this point in the history
While it is likely that after sequence of:

p1 = malloc(size);
free(p1);
p2 = malloc(size);

Both p1 and p2 would point to the same address
it is not guaranteed and it has been reported
that this test fails sometimes because the
pointers differ.

Signed-off-by: Cyril Hrubis <[email protected]>
  • Loading branch information
metan-ucw committed Oct 16, 2012
1 parent 4f64f45 commit cb4b5a5
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions testcases/kernel/mem/mem/mem02.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
*
* Copyright (c) International Business Machines Corp., 2002
* Copyright (c) 2012 Cyril Hrubis <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -119,19 +120,6 @@ int main(int argc, char **argv)
tst_exit();
}

pm2 = pm1;
free(pm1);

if ((pm1 = calloc(memsize, 1)) == NULL) {
tst_resm(TFAIL, "calloc did not alloc memory ");
tst_exit();
}

if (pm1 != pm2) {
tst_resm(TINFO, "pm1=%p pm2=%p ", pm1, pm2);
tst_resm(TFAIL, "free did not dealloc memory ");
tst_exit();
}
free(pm1);

tst_resm(TPASS, "calloc - calloc of %uMB of memory succeeded",
Expand All @@ -154,18 +142,6 @@ int main(int argc, char **argv)
tst_exit();
}

pm2 = pm1;
free(pm1);

if ((pm1 = malloc(memsize)) == NULL) {
tst_resm(TFAIL, "malloc did not alloc memory ");
tst_exit();
}

if (pm1 != pm2) {
tst_resm(TFAIL, "free did not dealloc memory ");
tst_exit();
}
free(pm1);

tst_resm(TPASS, "malloc - malloc of %uMB of memory succeeded",
Expand Down

0 comments on commit cb4b5a5

Please sign in to comment.