AussieGuy69
November 4th, 2008, 05:27 AM
This function crashes my program with
*** glibc detected *** gnutella: corrupted double-linked list: 0x08835df8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7744d81]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7745cad]
/usr/lib/libglib-2.0.so.0(g_malloc+0x2d)[0xb79afdcd]
My code is below:
void add_alternate_source(char filename[]) {
int *file_size;
int sha1;
struct stat *file_stat;
//initalise file stats
printf("\nGetting file statistics for %s \n", filename); //works, prints out fine
int result = stat(filename, file_stat);
//get file size
printf("\n Size of file: %u\n", file_stat->st_size); //works, prints file size fine.
//get file sha1
//add X-Alternate-Location
}
int main() {
gchar *filename = "/home/myusername/shared/testfile";
add_alternate_source(filename);
}
any idea what I might be doing wrong?
*** glibc detected *** gnutella: corrupted double-linked list: 0x08835df8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7744d81]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7745cad]
/usr/lib/libglib-2.0.so.0(g_malloc+0x2d)[0xb79afdcd]
My code is below:
void add_alternate_source(char filename[]) {
int *file_size;
int sha1;
struct stat *file_stat;
//initalise file stats
printf("\nGetting file statistics for %s \n", filename); //works, prints out fine
int result = stat(filename, file_stat);
//get file size
printf("\n Size of file: %u\n", file_stat->st_size); //works, prints file size fine.
//get file sha1
//add X-Alternate-Location
}
int main() {
gchar *filename = "/home/myusername/shared/testfile";
add_alternate_source(filename);
}
any idea what I might be doing wrong?