summaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
Diffstat (limited to 'libpcsxcore')
-rwxr-xr-xlibpcsxcore/misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 64c80ab2..47c8f85e 100755
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -541,9 +541,11 @@ int SaveState(const char *file) {
free(gpufP);
// spu
- spufP = (SPUFreeze_t *) malloc(16);
+ spufP = (SPUFreeze_t *) malloc(16); // only first 3 elements (up to Size)
SPU_freeze(2, spufP);
Size = spufP->Size; gzwrite(f, &Size, 4);
+ if (Size <= 0)
+ return 1; // error
free(spufP);
spufP = (SPUFreeze_t *) malloc(Size);
SPU_freeze(1, spufP);