delorie.com/archives/browse.cgi | search |
From: | "Andy Kilner" <andy AT kilner DOT karoo DOT co DOT uk> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Sigabort and Sigseg errors with new operator |
Date: | Mon, 5 Jul 1999 01:42:22 +0100 |
Organization: | Customer of Planet Online |
Lines: | 51 |
Message-ID: | <7lout9$e6t$1@newsreader1.core.theplanet.net> |
NNTP-Posting-Host: | modem82.skinner.kingston-internet.net |
X-Trace: | newsreader1.core.theplanet.net 931135209 14557 195.92.235.82 (5 Jul 1999 00:40:09 GMT) |
NNTP-Posting-Date: | 5 Jul 1999 00:40:09 GMT |
X-Complaints-To: | abuse AT theplanet DOT net |
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
I have been getting various errors from the following code mainly at the line (n = new char[l];), with the code as it is below the error is SIGABRT when run in RHIDE and a GPF in Windows. char* b[bytes_used]; unsigned int p[bytes_used]; int s[bytes_used]; // // other statements // assigns values to various arrays // int l, c = bytes_used; char* n; do{ sort(p, b, c); p[c-2] += p[c-1]; s[c-2] += s[c-1]; l = s[c-2] + 1; n = new char[l]; strcpy(n, b[c-2]); strcat(n, b[c-1]); delete[] b[c-2]; delete[] b[c-1]; b[c-2] = n; c--; }while(c > 1); delete[] b[0]; delete[] b[1]; I've tried different combinations of delete[] but that makes no difference, the error occurs in malloc but I must be writing to unassigned memory myself but I can't see where. The error normally occurs after the 5 iteration of about 75 total. I would be grateful for any help AK. PS. I tried using Yamd but couldn't get it to work unfortunately.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |