Code:
$ valgrind --db-attach=yes ./a.out
==2092== Memcheck, a memory error detector
==2092== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==2092== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==2092== Command: ./a.out
==2092==
==2092== Syscall param stat(file_name) contains uninitialised byte(s)
==2092== at 0x4F04DE5: _xstat (xstat.c:38)
==2092== by 0x400794: qs_struct (bar.c:28)
==2092== by 0x400716: quick_struct (bar.c:13)
==2092== by 0x4009C1: main (bar.c:71)
...
(gdb) up
#1 0x0000000000400795 in qs_struct (namelist=0x51b9330, left=0, right=60) at bar.c:28
28 stat(namelist[j]->d_name, &jbuf);
(gdb) info locals
i = 0
j = 60
temp = 0x4005f0
ibuf = {st_dev = 21, st_ino = 9046210, st_nlink = 13, st_mode = 16877, st_uid = 1000, st_gid = 1000, __pad0 = 0, st_rdev = 0, st_size = 20480,
st_blksize = 4096, st_blocks = 40, st_atim = {tv_sec = 1333383593, tv_nsec = 458878153}, st_mtim = {tv_sec = 1333383588, tv_nsec = 748866984}, st_ctim = {
tv_sec = 1333383588, tv_nsec = 748866984}, __unused = {0, 0, 0}}
jbuf = {st_dev = 85694544, st_ino = 85695408, st_nlink = 85692464, st_mode = 85692752, st_uid = 0, st_gid = 85690544, __pad0 = 0, st_rdev = 0, st_size = 4354,
st_blksize = 939536896, st_blocks = 80, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 60, tv_nsec = 4354}, st_ctim = {tv_sec = 85688496,
tv_nsec = 85693232}, __unused = {0, 4354, 939534736}}
xbuf = {st_dev = 85695120, st_ino = 85695504, st_nlink = 85691824, st_mode = 85689136, st_uid = 0, st_gid = 85691616, __pad0 = 0, st_rdev = 85689856,
st_size = 85692656, st_blksize = 85694352, st_blocks = 85691216, st_atim = {tv_sec = 85689344, tv_nsec = 85694032}, st_mtim = {tv_sec = 85694448,
tv_nsec = 85692272}, st_ctim = {tv_sec = 85692368, tv_nsec = 85690144}, __unused = {85692560, 85690336, 85689024}}
(gdb) up
#2 0x0000000000400717 in quick_struct (namelist=0x51b9330, count=60) at bar.c:13
13 qs_struct(namelist,0,count);
(gdb) up
#3 0x00000000004009c2 in main () at bar.c:71
71 quick_struct(namelist, n);
(gdb) print n
$1 = 60
The first problem is you have j=right, then you try to access namelist[j]