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, thanthen 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";"AT+CIPSSEND");
Also check ifthat 26 bytes is enough, makechange it to 128 bytes to be sure (later checkcheck the correct amount you need later).