Fixed memory allocation bugs ... you don't free memory returned by getenv apparently.
This commit is contained in:
parent
e04cca4ad9
commit
7a9f0694e9
@ -186,7 +186,8 @@ struct gallery_list* list_galleries() {
|
|||||||
dprintf("list_galleries: read from %s\n",my_dir);
|
dprintf("list_galleries: read from %s\n",my_dir);
|
||||||
DIR* dir = opendir( my_dir );
|
DIR* dir = opendir( my_dir );
|
||||||
if ( dir == NULL ) {
|
if ( dir == NULL ) {
|
||||||
gcfree( my_dir );
|
dputs("list_galleries: couldn't open directory... returning NULL\n");
|
||||||
|
//gcfree( my_dir );
|
||||||
destroy_vararray( va );
|
destroy_vararray( va );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ char* resize_photo( struct photo_meta* dest,
|
|||||||
|
|
||||||
char* dir = get_cgidir();
|
char* dir = get_cgidir();
|
||||||
char* cache_path = construct_path( "s/s", dir, cache_file );
|
char* cache_path = construct_path( "s/s", dir, cache_file );
|
||||||
gcfree( dir );
|
//gcfree( dir );
|
||||||
|
|
||||||
/* Check if the file already exists... if it does, return now */
|
/* Check if the file already exists... if it does, return now */
|
||||||
struct stat cache_stat;
|
struct stat cache_stat;
|
||||||
|
@ -12,10 +12,13 @@ struct mem_chunk* gc_find_chunk( void* ptr ) {
|
|||||||
dprintf("gc_find_chunk: locating chunk for ptr %p\n", ptr);
|
dprintf("gc_find_chunk: locating chunk for ptr %p\n", ptr);
|
||||||
struct mem_chunk* chunk = gc_head;
|
struct mem_chunk* chunk = gc_head;
|
||||||
while( chunk != NULL )
|
while( chunk != NULL )
|
||||||
if ( chunk->ptr == ptr )
|
if ( chunk->ptr == ptr ) {
|
||||||
|
dprintf("gc_find_chunk: located chunk for ptr %p at %p\n", ptr, chunk);
|
||||||
return chunk;
|
return chunk;
|
||||||
else
|
} else {
|
||||||
chunk = chunk->next;
|
chunk = chunk->next;
|
||||||
|
}
|
||||||
|
dprintf("gc_find_chunk: chunk for ptr %p not found\n", ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ void* gcrealloc( void* ptr, size_t size ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gcfree( void* ptr ) {
|
void gcfree( void* ptr ) {
|
||||||
dprintf("gcfree: freeing memory at %p\n", ptr);
|
dprintf("gcfree: freeing memory at %p (content: %10s...)\n", ptr, (char*)ptr);
|
||||||
struct mem_chunk* chunk = gc_find_chunk( ptr );
|
struct mem_chunk* chunk = gc_find_chunk( ptr );
|
||||||
if ( chunk == NULL ) {
|
if ( chunk == NULL ) {
|
||||||
free( ptr );
|
free( ptr );
|
||||||
|
Loading…
Reference in New Issue
Block a user