filename = cl_malloc(sizeof(char) * filename_len);
filename = crm_malloc(sizeof(char) * filename_len);
admin_msg_callback(IPC_Channel * server, void *private_data){	int lpc = 0;	IPC_Message *msg = NULL;	gboolean hack_return_good = TRUE;	static int received_responses = 0;	char *filename;	int filename_len = 0;	const char *result = NULL;	xmlNodePtr options = NULL;	xmlNodePtr xml_root_node = NULL;	char *buffer = NULL;	FNIN();	while (server->ch_status != IPC_DISCONNECT	       && server->ops->is_message_pending(server) == TRUE) {		if (server->ops->recv(server, &msg) != IPC_OK) {			perror("Receive failure:");			FNRET(!hack_return_good);		}		if (msg == NULL) {			CRM_DEBUG("No message this time");			continue;		}		lpc++;		buffer =(char *) msg->msg_body;		CRM_DEBUG("Got xml [text=%s]", buffer);		xml_root_node =			find_xml_in_ipcmessage(msg, TRUE);		if (xml_root_node == NULL) {			cl_log(LOG_INFO,			       "XML in IPC message was not valid... "			       "discarding.");			continue;		} else if (validate_crm_message(xml_root_node,					 crm_system_name,					 admin_uuid,					 "response") == FALSE) {			cl_log(LOG_INFO,			       "Message was not a CRM response. Discarding.");			continue;		}		options = find_xml_node(xml_root_node,						   XML_TAG_OPTIONS);				result = xmlGetProp(options, XML_ATTR_RESULT);		if(result == NULL || strcmp(result, "ok") == 0) {			result = "pass";		} else {			result = "fail";		}				received_responses++;		// do stuff		if (this_msg_reference != NULL) {			// in testing mode...			/* 31 = "test-_.xml" + an_int_as_string + '\0' */			filename_len = 31 + strlen(this_msg_reference);			filename = cl_malloc(sizeof(char) * filename_len);			sprintf(filename, "%s-%s_%d.xml",				result,				this_msg_reference,				received_responses);						filename[filename_len - 1] = '\0';			if (xmlSaveFormatFile(filename,					      xml_root_node->doc, 1) < 0) {				cl_log(LOG_CRIT,				       "Could not save response %s_%s_%d.xml",				       this_msg_reference,				       result,				       received_responses);			}		}	}	if (server->ch_status == IPC_DISCONNECT) {		cl_log(LOG_INFO, "admin_msg_callback: received HUP");		FNRET(!hack_return_good);	}	if (received_responses >= expected_responses) {		cl_log(LOG_INFO,		       "Recieved expected number (%d) of messages from Heartbeat."		       "  Exiting normally.", expected_responses);		g_main_quit(mainloop);		return !hack_return_good;	}	FNRET(hack_return_good);}