Arduino crashing during serial print for no obvious reason
This code looks wrong:

  command = malloc(26);
  command = "AT+CIPSSEND";
  strcat(command, number);
  strcat(command, ",");
  strcat(command, length_of_payload);
  send_wlan_chip_command(command);


First you allocate 26 bytes, then a new string is created, which you strcat to it. This happens in memory that is not allocated (or overwrites other data).

Instead of 

  command = "AT+CIPSSEND";


use

  strcpy(command, "AT+CIPSSEND");


Also check that 26 bytes is enough, change it to 128 bytes to be sure (check the correct amount you need later).