channel[ch].channel_layer = (int8 *)safe_realloc(channel[ch].channel_layer, sizeof(int8) * (i + 2)); 
if (channel[ch].channel_layer == NULL) channel[ch].channel_layer = (int8 *)safe_malloc(sizeof(int8) * (MAX_CHANNELS + 1)); 
void add_channel_layer(int ch, int fromch){	int i, j = 0;	int8 layer[MAX_CHANNELS];	if(fromch >= MAX_CHANNELS || ch >= MAX_CHANNELS) {return;}	/* delete an overlapping channel layer */	if(channel[fromch].channel_layer != NULL) {		memcpy(layer, channel[fromch].channel_layer, sizeof(channel[fromch].channel_layer));		for(i = 0; i < MAX_CHANNELS; i++)		{			if(layer[i] == -1) {				channel[fromch].channel_layer[j] = -1;				break;			} else if(layer[i] != fromch) {				channel[fromch].channel_layer[j] = layer[i];				j++;			}		}	}	/* add a channel layer */	for(i = 0; i < MAX_CHANNELS; i++)	{		if(channel[ch].channel_layer == NULL || channel[ch].channel_layer[i] == -1) {			channel[ch].channel_layer = (int8 *)safe_realloc(channel[ch].channel_layer, sizeof(int8) * (i + 2));			channel[ch].channel_layer[i] = fromch;			channel[ch].channel_layer[i + 1] = -1;			if(i > 0) {				ctl->cmsg(CMSG_INFO, VERB_NOISY, "Channel Layer (CH:%d -> CH:%d)", fromch, ch);			}			break;		} else if(channel[ch].channel_layer[i] == fromch) {			break;		}	}}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/55a9ebe8e8a9bc3efeb7135d8429af175944175b/readmidi.c/buggy/timidity/readmidi.c