- don't allocate: char *p = malloc(len * sizeof(char *)) when you mean: char *p = malloc(len) - eliminate duplicated code by creating functions and try not to wrap - use mvwinnstr instead of mvwinstr