For some reason malloc fails in one particular instance when I attempt to use it. It is when I pass the return value of a function that simply returns a DWORD. I multiply the DWORD by the size of a structure (which is 5), and the result in my tests is between 60 and 100, though it will be greater in actual use. Essentially, I have this:
lpTest = (THESTRUCTURE *)malloc(GetItemCount() * sizeof(THESTRUCTURE));
Every time I run the program it fails on the call to malloc. If I subsitute a constant in in the place of GetItemCount() it succeeds. As well, it does not fail if I am debugging. Any ideas?
Thanks in advance,