Quote Originally Posted by Elysia View Post
The thing is, it's not.
Do the reverse of your allocation. Replace malloc with free.
Free every element in wordArray. From wordArray[0] to wordArray[numWords - 1].
THEN free wordArray itself.
You're just freeing the FIRST element of wordArray.
Code:
	for(j = 0; j < numWords-1; j++) {
	  printf("&#37;d: %s ", j, wordArray[j]);
	  free(wordArray[j]);
	}

	free(wordArray);
	return 0;
That is exactly how I have had it since you first mentioned the memory leak. If that is not the solution I don't know what is and at this point I couldn't care less.