2

You are getting that error because in your 'load' function, you are inicializing the value 'next' here: temp->next = table[index]; inside an 'if' condition. If you also set temp->next to NULL after you declare it, you'll be good to go.


2

The problem lies in each of the malloc's in check and unload. All three node pointer vars that are created are used to process existing nodes, yet all three are initialized with malloc calls. They should be set/initialized to NULL instead. This is a common error by new programmers. They believe that memory must be allocated to any pointer that is created. ...


1

I just found a subtle error in the check function. The allocated size for the string is wrong. It's should've been word_copy[n + 1] instead of word_copy[LENGTH]. Thank you for your input though. I'm actually surprised that my program worked in the other scenarios.


1

The problem is that the tree isn't being freed. You could add a printf statement inside the unload function's loop to show it. The cause is interesting, it leads to unpredictable results in a full scale run. Sometimes it will work, sometimes it might not. I'll give you a big hint. Have you checked the hash values being generated? Also, what is the ASCII ...


1

Interesting... 1 block, 552 bytes related to an fopen statement in load. What's the size of a file pointer? Did you remember to close the dictionary file before ending the load function? ;-) BTW, why does load return false when it completes successfully? Hint: valgrind might give you some clues about memory leaks in a program, but you should be focused ...


1

Since all the memory is still reachable, it's a good bet that it wasn't freed correctly in unload. There are several issues with the unload function. First, the two return statements inside the for loop will cause the unload function to terminate prematurely, before it has traversed the tree. Get rid of them. Next, there's nothing in unload() that actually ...


1

I believe there's still an error here, though I'm not entirely sure in this case: for (int i = 0; i < N; i++) { if (table[i] != NULL) { //temp points to what table points to temp = table[i]; //cursor points to what table points to cursor = table[i]; do { //cursor goes to the next node ...


1

Simple. Every time a word is found, the code returns true BEFORE it executes the free call. You could fix this by adding another free call before the return statement, but why use an intermediate pointer and a malloc in the first place - a second one at that? It's a one-time throw away use. It makes more sense and less overhead to just use trav->word in ...


1

Perhaps there's a slight oversight in your code. Look at the following: lc_word[len + 1] = '\0'; Now, say that the word is "Cat". Length is 3 so len = 3. Remember that arrays start at 0, not 1. So, "Cat" or "cat" would occupy 0, 1 and 2. The line of code above would put the end of string marker at lc_word[3+1], or lc_word[...


1

It looks like your blur function is trying to access a non-existent pixel at image[height-1][width]. If so, that's probably not the only reference outside the boundary of image.


Only top voted, non community-wiki answers of a minimum length are eligible