Here's your valgrind result. Interestingly, it doesn't segfault and crash when run from valgrind - it just keeps on trucking. Nevertheless, you can certainly see where it WAS crashing, and tons of errors occurring there. --2012-07-08 20:07:22-- http://www.[redacted]/%E2%80%9Dhttp://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js%E2%80%9D Reusing existing connection to www.[redacted]:80. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.[redacted]/%E2%80%9Dhttp:/ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js%E2%80%9D [following] ==10570== Invalid read of size 1 ==10570== at 0x4C2BFA2: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x42BE73: remote_to_utf8 (iri.c:272) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a0 is 0 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 1 ==10570== at 0x4C2BFB4: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x42BE73: remote_to_utf8 (iri.c:272) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a1 is 1 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 1 ==10570== at 0x42BE7D: remote_to_utf8 (iri.c:274) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a0 is 0 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 1 ==10570== at 0x42BE8C: remote_to_utf8 (iri.c:274) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a1 is 1 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 1 ==10570== at 0x4C2BFC2: __GI_strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x59197F5: strdup (strdup.c:42) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a0 is 0 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 1 ==10570== at 0x4C2BFD4: __GI_strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x59197F5: strdup (strdup.c:42) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a1 is 1 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922392: __GI_memcpy (memcpy.S:197) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a0 is 0 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922395: __GI_memcpy (memcpy.S:198) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0a8 is 8 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922399: __GI_memcpy (memcpy.S:199) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0b0 is 16 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x592239D: __GI_memcpy (memcpy.S:200) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0b8 is 24 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x59223BC: __GI_memcpy (memcpy.S:214) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0c0 is 32 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x59223BF: __GI_memcpy (memcpy.S:215) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0c8 is 40 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x59223C3: __GI_memcpy (memcpy.S:216) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0d0 is 48 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x59223C7: __GI_memcpy (memcpy.S:217) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0d8 is 56 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 2 ==10570== at 0x59222DE: __GI_memcpy (memcpy.S:84) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0e0 is 64 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 4 ==10570== at 0x59222F5: __GI_memcpy (memcpy.S:96) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0e2 is 66 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922306: __GI_memcpy (memcpy.S:108) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0e6 is 70 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922320: __GI_memcpy (memcpy.S:123) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0ee is 78 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== ==10570== Invalid read of size 8 ==10570== at 0x5922323: __GI_memcpy (memcpy.S:124) ==10570== by 0x42BEBD: remote_to_utf8 (iri.c:276) ==10570== by 0x427244: url_parse (url.c:700) ==10570== by 0x4248F9: retrieve_url (retr.c:794) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x636f0f6 is 86 bytes inside a block of size 94 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== --2012-07-08 20:07:22-- http://www.[redacted]/%E2%80%9Dhttp://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js%E2%80%9D Reusing existing connection to www.[redacted]:80. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.[redacted]/%E2%80%9Dhttp:/ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js%E2%80%9D [following] --2012-07-08 20:07:22-- http://www.[redacted]/%E2%80%9Dhttp:/ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js%E2%80%9D Reusing existing connection to www.[redacted]:80. HTTP request sent, awaiting response... 404 Not Found 2012-07-08 20:07:23 ERROR 404: Not Found. ==10570== Invalid free() / delete / delete[] / realloc() ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x42C0BC: iri_free (iri.c:330) ==10570== by 0x422627: retrieve_tree (recur.c:448) ==10570== by 0x4053BA: main (main.c:1388) ==10570== Address 0x6370dc0 is 0 bytes inside a block of size 105 free'd ==10570== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10570== by 0x4248E2: retrieve_url (retr.c:791) ==10570== by 0x422734: retrieve_tree (recur.c:283) ==10570== by 0x4053BA: main (main.c:1388) ==10570== --2012-07-08 20:07:23-- http://www.[redacted]/shows-page/ Reusing existing connection to www.[redacted]:80. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: `index.html'