[AD] mis-matched realloc()/_AL_FREE() and _AL_MALLOC_ATOMIC()/free() in file.c |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Allegro Conductors [AD]" <Alleg-developers@xxxxxxxxxx>
- Subject: [AD] mis-matched realloc()/_AL_FREE() and _AL_MALLOC_ATOMIC()/free() in file.c
- From: Andrei Ellman <ae-a-alleg@xxxxxxxxxx>
- Date: Sun, 24 Dec 2006 13:08:42 +0100
- Organization: Wacko Software
Hi,
I've finally been able to confirm with absolute certainty that the
problem I reported with file.c has gone. However, I discovered
mismatching _AL_MALLOC_ATOMIC()/free() and realloc()/_AL_FREE() pairs in
pack_fopen_chunk(). The attatched patch replaces realloc() with
_AL_REALLOC() and free() with _AL_FREE()
Also worth discussing is whether or not it's worth doing something about
the '\/\' sequence in tmp_name. IIRC, I think that on the Mac, tmp_name
might contain a '//' sequence.
AE.
--- file.c.old 2006-12-24 11:30:19.261672000 +0100
+++ file.c 2006-12-24 11:30:30.117281600 +0100
@@ -1960,7 +1960,7 @@ PACKFILE *pack_fopen_chunk(PACKFILE *f,
/* Get the path of the temporary directory */
do {
size = new_size;
- tmp_dir = realloc(tmp_dir, size);
+ tmp_dir = _AL_REALLOC(tmp_dir, size);
new_size = GetTempPath(size, tmp_dir);
} while ( (size < new_size) && (new_size > 0) );
@@ -2039,8 +2039,8 @@ PACKFILE *pack_fopen_chunk(PACKFILE *f,
chunk->normal.flags |= PACKFILE_FLAG_CHUNK;
}
- free(tmp_dir);
- free(tmp_name);
+ _AL_FREE(tmp_dir);
+ _AL_FREE(tmp_name);
}
else {
/* read a sub-chunk */