Mail Archives: djgpp/2004/10/08/03:15:25
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
Message-ID: | <41663c2c$0$179$cc7c7865@news.luth.se>
|
From: | Martin Str|mberg <ams AT speedy DOT ludd DOT ltu DOT se>
|
Subject: | Re: Free() crash my program!
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <D7Kdnfji89etsfvcRVn-qA AT comcast DOT com>
|
User-Agent: | tin/1.4.6-20020816 ("Aerials") (UNIX) (NetBSD/1.6Q (alpha))
|
Date: | 08 Oct 2004 07:05:16 GMT
|
Lines: | 31
|
NNTP-Posting-Host: | speedy.ludd.ltu.se
|
X-Trace: | 1097219116 news.luth.se 179 130.240.16.13
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
JC <jessechao AT comcast DOT net> wrote:
> I used djgpp to develop a simple program, using dosmemget(),
> to dump some DOS memory. The code is like following:
> p = (UINT8 *)malloc(len+1);
> if (p == NULL)
> {
> ...
> }
> dosmemget(addr, len, p);
> /* Code to printf the contents in *p */
> ...
> free(p);
> The code compiled & ran fine. But when the code execute
> the free(). The code crashed and got SIGSEG error:
> Exiting due to signal SIGSEGV
> General Protection Fault at eip=00006ac4
> Anyone can help me on this?
1. Remove that UINT8 * cast.
2. If that doesn't help you need to give more information, because
malloc() and free() work fine so it must be something else.
Right,
MartinS
- Raw text -