I had a working code, such as the one below:
Code:
typedef struct { int* data } FIELD;
FIELD* pField;
fields;

allocint(int** i,j,k) {
*i = malloc(sizeof(int*));
...
}

...
realloc(pField,...);
allocint(&pField[fields].data,...);
...
Of course, I've cut most of the code. This method worked fine, but once there got to be about a thousand "realloc(pField,...);" calls, I started to get memory errors. So to fix that, I tried this sort of code:
Code:
typedef struct { int* data } FIELD;
FIELD* pField[MAX_FIELDS];
fields;

allocint(int** i,j,k) {
*i = malloc(sizeof(int*));
...
}

...
pFields[fields] = malloc(...);
allocint(&pField[fields]->data,...);
...
Now the program immediately has memory problems when calling allocint (It keeps saying that there is an error with "free()", but that isn't being used...)

I know that this problem has something to do with the &pField[fields]->data. I suppose that the function is not receiving an editable address of the data variable, but I haven't a clue on how to fix this. I barely understand how double pointers and the like work anyway.

I hope I didn't cut out so much of the code that it isn't clear what my intentions were. Thanks for your time!