Re: memcmp() checker: memory access errors
- From: "kolmogolov@xxxxxxxxx" <kolmogolov@xxxxxxxxx>
- Date: 18 Dec 2006 10:20:14 -0800
Richard Bos wrote:
malc <malc@xxxxxxxxxxxxx> wrote:(...)
There's a memory leak here. But as far as i can see that's not what
checker complains about.
Doesn't even get there. I'm beginning to suspect that what Checker
checked is not the posted code.
I almost suspected that too after reading your words and went back;
booted a machine freshly; cd /tmp; extract only the file "bug.c" (which
is
extactly the same file posted for I have just cut and pasted the posted
codes and did a diff to bug.c); checker gcc -Wall bug.c;
../a.out sample.kdf and there it is:
(...)
4 memory access errors reported.
4 memory access errors.
2 malloc/mmalloc calls.
0 free/mfree calls.
0 realloc/mrealloc calls.
Total time used for garbage detecting: 0 sec(s) 0 usecs.
The file "bug.c" has been extracted from a much bigger
progam "any2pgm.c" for the posting, including replacing
error handling by assert()'s to make it small and ready to
compile. Would anyone please bounds-check that for me
too using her/his checker?
And by memory leak, you do mean the malloc'ed array
data[]? If so, thanks for the hint. It is called in the
whole program only once but I'll keep an eye on that.
If not, would you please verbose on this for I'm no
professional programmer.
BTW. I do ungetc() all 256 bytes in data[] back to the stream
for decoupling the probe_img() from all the other functions
for parsing the details of the headers. I thought tha it were s
a proper size for probing many kinds of my image files.
I'll re-read about the mentioned NDEBUG again for I
don't get it yet ...
.
- Follow-Ups:
- Re: memcmp() checker: memory access errors
- From: Kohn Emil Dan
- Re: memcmp() checker: memory access errors
- From: malc
- Re: memcmp() checker: memory access errors
- References:
- memcmp() checker: memory access errors
- From: kolmogolov@xxxxxxxxx
- Re: memcmp() checker: memory access errors
- From: malc
- Re: memcmp() checker: memory access errors
- From: Richard Bos
- memcmp() checker: memory access errors
- Prev by Date: Re: Files & dirs: historical reasons?
- Next by Date: Re: Files & dirs: historical reasons?
- Previous by thread: Re: memcmp() checker: memory access errors
- Next by thread: Re: memcmp() checker: memory access errors
- Index(es):
Relevant Pages
|