From: <ch...@su...> - 2012-09-20 14:29:14
|
Hi! > Following are the lines of code where the test case is exiting, for kernel > 3.0.15 (ICS). > > 128 pm2=pm1; > 129 free(pm1); > 130 > 131 if((pm1=(char *)calloc(memsize,1)) == NULL) { > 132 tst_resm(TFAIL, "calloc did not alloc memory "); > 133 tst_exit(); > 134 } > 135 > 136 if(pm1 != pm2) { > 137 tst_resm(TINFO, "pm1=%p pm2=%p ", pm1,pm2); > 138 tst_resm(TFAIL, "free did not dealloc memory "); > 139 > tst_exit(); // *Here > code is exited in kernel 3.0.15 while it is passing in case of kernel 3.4 > (ICS)*. > 140 } > > > > *LTP version = "LTP-20100630"* > > at line 136 my test is failing. Now isnt this condition of the dangling > pointer. At line 129 we are freeing pm1 this means that pm2 becomes a > dangling pointer. > And how come after doing > pm1=(char *)calloc(memsize,1) > pm1 is equal to pm2 for kernel 3.4 (ICS) (Since this test case is passing > for that)?? > > According to me, it should not be equal. Indeed this test seems to be wrong. My guess is that it was written with 'it works so and so it must be true' attitude as it's not unlikely to get same pointer if you request chunk of a same size directly after you free one. So my conclusion is that the test is broken and should be fixed. Do you care to send a patch (against latest git tree)? -- Cyril Hrubis ch...@su... |