[ee122] Segfault Madness (need expert)

Drew Lustro drewlustro at gmail.com
Wed Oct 31 02:21:33 PDT 2007


This may be one of the most difficult to explain problems, but I'll  
try.  I've been working on the server and everything was OK and then I  
started getting segfaults. I was confused since the recent changes did  
NOT involve any malloc'ing / freeing of any sort! After some tedious,  
tedious commenting and uncommenting (because Eclipse's debugger was  
totally useless), I found that if I uncomment a single declaration,  
the segfaults vanish.

I added this BOOL declaration line to the top of  
processClientInput(client):

int processClientInput(sockAndBufs &client)
{
	int bytes = consumeRequestLine(client);
	char ** uri;
	char * uri_string;
		   bool keepAlive = false; // THIS, OF ALL THINGS IS WHAT CAUSES THE  
SEGFAULTING

	// ... tons more code
	// note: uri and uri_string do involve mallocing, but did not give me  
any trouble in the past


Can any C/C++ Guru shed some light on this? Why would commenting out  
the "bool" line lead to no segfaulting? Such an obscure problem is  
throwing me off so hard that I'm starting to believe this project is  
just a get-pissed-off-at-c project rather than us learning anything  
new about socket programming.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/ee122/attachments/20071031/0968a068/attachment.html 


More information about the ee122 mailing list