ESP32 Memory Leak?

// Send the gcode to the queue
  for (const auto &instr : gcode)
  {
    char *gcodeLine;
    if (instr.command == "M7" || instr.command == "M8" || instr.command == "M2" || instr.command == "G21" || instr.command == "G90" || instr.command == "F1250")
    {
      gcodeLine = new char[instr.command.length() + 1];
      sprintf(gcodeLine, "%s", instr.command.c_str());
    }
    else
    {
      gcodeLine = new char[20];
      sprintf(gcodeLine, "%s X%.2f Y%.2f", instr.command.c_str(), instr.x, instr.y);
    }
    gcodeQueue.push(gcodeLine);
  }

aber wenn ich doch nachdem ich den gcode da rein pushe delete mache dann lösche ich den gcode doch direkt wieder?