From: "Daniel Eaton" Newsgroups: comp.os.msdos.djgpp Subject: GPEs... Lines: 45 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Message-ID: Date: Tue, 22 Jun 1999 21:26:34 -0700 NNTP-Posting-Host: 216.66.137.69 X-Trace: newsgate.direct.ca 930111720 216.66.137.69 (Tue, 22 Jun 1999 21:22:00 PDT) NNTP-Posting-Date: Tue, 22 Jun 1999 21:22:00 PDT Organization: Canada Internet Direct, Inc. To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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; } }