What I do with moduleGetLastBuffer like this and it seems to work well, never free()'d as Viper says:
text = moduleGetLastBuffer();
if (text) {
cmd = myStrGetToken(text, ' ', 0);
text = myStrGetToken(text, ' ', 1);
if (strcasecmp(cmd, "BASIC") == 0) {