473,238 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

Access violation - Malloc problem

146: unsigned short *sDate;
147:
148: sDate = (unsigned short *)malloc(100);
17E4157C 6A 64 push 64h
17E4157E E8 05 4C 00 00 call malloc (17e46188)
17E41583 83 C4 04 add esp,4
17E41586 89 45 FC mov dword ptr [sDate],eax
When running only the line 17E4157E (malloc), I get next error :

First Chance Exception in : 0xC0000005: Access Violation
Jul 22 '05 #1
3 5776
"Rossel NathanaŽl" <na**************@gem-ag.com> writes:

Maybe a litle bit information of the code following to the malloc call
would be helpfull!
146: unsigned short *sDate;
147:
148: sDate = (unsigned short *)malloc(100);


Try to write this line another way:
sDate=(unsigned chort*) malloc(100 * sizeof(unsigned short));

BTW this is a c++ newsgroup and so the following thing would be better
in C++:

sDate = new unsigned short[100]; ;-)

HTH && Kind regards,
Nicolas
--
| Nicolas Pavlidis | Elvis Presly: |\ |__ |
| Student of SE & KM | "Into the goto" | \|__| |
| pa****@sbox.tugraz.at | ICQ #320057056 | |
|-------------------University of Technology, Graz----------------|
Jul 22 '05 #2

"Rossel NathanaŽl" <na**************@gem-ag.com> wrote in message
news:41********@news.bluewin.ch...
146: unsigned short *sDate;
147:
148: sDate = (unsigned short *)malloc(100);
17E4157C 6A 64 push 64h
17E4157E E8 05 4C 00 00 call malloc (17e46188)
17E41583 83 C4 04 add esp,4
17E41586 89 45 FC mov dword ptr [sDate],eax
When running only the line 17E4157E (malloc), I get next error :

First Chance Exception in : 0xC0000005: Access Violation


Your heap has been corrupted by some earlier bug in your code.

john
Jul 22 '05 #3
The problem has been resolve. They was a malloc(8) in an other function and
a strcpy with 9 character ('\0').

"Rossel NathanaŽl" <na**************@gem-ag.com> a ťcrit dans le message de
news:41********@news.bluewin.ch...
146: unsigned short *sDate;
147:
148: sDate = (unsigned short *)malloc(100);
17E4157C 6A 64 push 64h
17E4157E E8 05 4C 00 00 call malloc (17e46188)
17E41583 83 C4 04 add esp,4
17E41586 89 45 FC mov dword ptr [sDate],eax
When running only the line 17E4157E (malloc), I get next error :

First Chance Exception in : 0xC0000005: Access Violation

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steven Reddie | last post by:
In article <slrnbnj19j.av.juergen@monocerus.manannan.org>, Juergen Heinzl wrote: >In article <f93791bd.0309282133.650da850@posting.google.com>, Steven Reddie wrote: >> I understand that access...
3
by: paulrc_25 | last post by:
I'm working with C++ Builder 5.0 Enterprise Edition, and I got this message: Project CntSch.exe raised exception class EAccessViolation with message 'Access violation at address 40004B66 in...
0
by: Pegaso | last post by:
Hi... I have created a utility library with VC++ 7.1 which is used by a VB 6 client. The library creates a secondary thread of execution in order to listen for connections on a socket. The...
3
by: Binary | last post by:
VC++ .NET 2003: Access violation with /O2 compiler switch; no AV with /O Hi I'm in the process of narrowing down a problem, and I have reduced the code involved to the following If someone could...
14
by: spl | last post by:
I am getting access violation in the below program for the free() call, Whats wrong here and how to rectify it? ---------------------------------- #include <stdlib.h> #include <string.h>...
1
by: Dameon99 | last post by:
Hi, I have just spent many hours debugging my code and now when I run it I get the following error: "An access violation (Segmentation fault) raised in your program" I have researched on this...
1
by: casybay | last post by:
Hi all, I encounter a 'Access violation writing location 0x00e1d2e4' when executing my code. It worked fine when the size was smaller. The following is the code. Any help will be...
6
by: nmehring | last post by:
I have an MFC app with 2000 users. I have one user that experiences a crash in our software anywhere from 1 to 5 times a week when opening a particular module. No other users have reported this...
39
by: Martin | last post by:
I have an intranet-only site running in Windows XPPro, IIS 5.1, PHP 5.2.5. I have not used or changed this site for several months - the last time I worked with it, all was well. When I tried it...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youíll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.