www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/18/17:40:41

From: kagel AT quasar DOT bloomberg DOT com
Date: Wed, 18 Sep 1996 17:06:31 -0400
Message-Id: <9609182106.AA09262@quasar.bloomberg.com >
To: cs3prj04 AT lion DOT cs DOT latrobe DOT edu DOT au
Cc: djgpp AT delorie DOT com
In-Reply-To: <51ofn5$9do@lion.cs.latrobe.edu.au> (cs3prj04@lion.cs.latrobe.edu.au)
Subject: Re: Bus error with g++.
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   Errors-To: postmaster AT ns1
   From: cs3prj04 AT lion DOT cs DOT latrobe DOT edu DOT au (Cs3prj Group 04)
   Newsgroups: comp.lang.c++,comp.lang.c,comp.os.msdos.djgpp
   Date: 18 Sep 1996 09:34:29 GMT
   Organization: Comp.Sci & Comp.Eng, La Trobe Uni, Australia
   Lines: 165
   Distribution: world
   Nntp-Posting-Host: lion.cs.latrobe.edu.au
   Dj-Gateway: from newsgroup comp.os.msdos.djgpp
   Content-Type: text
   Content-Length: 4272


   I am getting a bus error in t_delete immediatley after a call to malloc
   (see below - look for BUS ERROR). It happens in a rather large program after 
   one particular modulehas been called and terminated. This module reads a file 
   into an array of strings for viewing. The module concerned is to large to 
   include in here but it does execute and terminate normally.

   Does this mean anything to anyone?

[SNIP]
   char *ErrorHandler(int ErrorNo)
   {
     int fd,i, CharsRead;
     char Buffer[BufferSize], MessageBuffer[SIZE];

   BUS ERROR OCCURS AFTER THIS NEXT STATEMENT.

     int *LineIndex = (int*)malloc(sizeof(int)*MAX_LINES); /*array oflineoffsets*/
     char *message = (char *)malloc(sizeof(char)*SIZE);
[SNIP]

I usually see this kind of error when some other piece of code has either
freed an address which was never malloc()d or freed it twice.  Look in that
module which recently terminated for a free() of an incorrect pointer, like
a pointer to an automatic or static, or for a free which could possibly be
called more than once.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019