(back-port of commit
9d019e2e from 'master')
* extra/symbian.cpp (GC_get_private_path_and_zero_file): Do not call
memcpy() if allocation of copyChar is failed.
* os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON] (zero_fd): Initialize
global variable to -1 (instead of 0).
* os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON && SYMBIAN]
(GC_unix_mmap_get_mem): Do not call open() and free() if path is NULL.
size_t size = path8.Length() + 1;
char* copyChar = (char*) malloc( size );
- memcpy( copyChar, path8.PtrZ(), size );
+ if (copyChar)
+ memcpy( copyChar, path8.PtrZ(), size );
return copyChar; // ownership passed
}
# define OPT_MAP_ANON MAP_ANON
# endif
#else
- static int zero_fd;
+ static int zero_fd = -1;
# define OPT_MAP_ANON 0
#endif
if (!EXPECT(initialized, TRUE)) {
# ifdef SYMBIAN
- char* path = GC_get_private_path_and_zero_file();
- zero_fd = open(path, O_RDWR | O_CREAT, 0666);
- free(path);
+ char *path = GC_get_private_path_and_zero_file();
+ if (path != NULL) {
+ zero_fd = open(path, O_RDWR | O_CREAT, 0666);
+ free(path);
+ }
# else
zero_fd = open("/dev/zero", O_RDONLY);
# endif