Вот вырезка из кода
struct ff_index {
int size;
long *index;
int pos;
int hash_start[65536];
int *hash_next;
unsigned short *sum16;
struct ff_data_heap *data;
};
struct ff_data_heap {
long size;
long pos;
char *data;
};
struct ff_index path_index;
struct ff_data_heap index_heap;
.................
if ( !(index_heap.data = (char*)malloc(index_heap.size)) ) {
printf("Can't allocate memory for heap.\n");
exit(ENOMEM);
}
.................
/// Вызывается для path_index
void InitIndexStruct(struct ff_index *index, int size) {
int i;
index->size = size;
index->pos = 0;
index->index = (long*)malloc(sizeof(long)*size);
index->hash_next = (int*)malloc(sizeof(int)*size);
index->sum16 = (unsigned short*)malloc(sizeof(unsigned short)*size);
if ( !index->index || !index->hash_next || !index->sum16 ) {
printf("Can't allocate memory for index\n");
exit(ENOMEM);
}
for (i=0; i<65536; index->hash_start[i++]=-1);
for (i=0; i<size; index->hash_next[i++]=-1);
index->data = &index_heap;
}
.................
//ERROR!!!
index_heap.data = (char)realloc((index_heap.size+500000));
Вот на этом месте прога слетает с Segmentation Falied (Core Dumped)
Думаю из-за того что структура в структуре..
А почему? И как победить...
На вас надеюсь!!! :)