Hi Gurus,

Trying to append a comma to a string. Getting "Segmentation Error" on Solaris when the function is entered the second time.

Code:
// Appends a comma to the given string
void appendComma(char* instring)
{
	if (instring == NULL)
	{	
		instring = realloc(NULL, strlen(","));
		strcpy(instring,",");
	}
	else
	{	
		instring = realloc(instring, strlen(instring) + strlen(",")); // ===> Segmentation error here
		strcat(instring,",");
	}		
}
Your help is alwasy appreciated.