X-Authentication-Warning: niemeyer.net: Host 200.230.186.180-as.acessonet.com.br [200.230.186.180] claimed to be computer From: "Gustavo Niemeyer" To: Subject: RE: GPEs... Date: Wed, 23 Jun 1999 17:31:11 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: Importance: Normal Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Maybe because if c=='>' you try to free container two times so you free something that is not allocated. I got some errors some time ago trying to do this. Gustavo Niemeyer -----Original Message----- From: Daniel Eaton [mailto:deaton AT direct DOT ca] Sent: Quarta-feira, 23 de Junho de 1999 01:27 To: djgpp AT delorie DOT com Subject: GPEs... Does anyone know why the mallocs give me a GPE about 50% of runs? Thanks, Daniel Eaton char *html_parse_tag_get(int filepos,FILE *fp) { fseek(fp,filepos,SEEK_SET); int c; c=fgetc(fp); if(!c=='<') return _ERROR; char *tag=NULL,*container=NULL; int tagl=0; for(;;) { c=fgetc(fp); if(c=='>') { free(container); tag[tagl-1]='\0'; return tag; } tagl++; free(container); container=(char *)malloc(tagl-1); strcpy(container,tag); free(tag); tag=(char *)malloc(tagl); strcpy(tag,container); tag[tagl-1]=c; } }