about summary refs log tree commit diff
path: root/src/afl-sharedmem.c
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-06-26 01:14:21 +0200
committerhexcoder- <heiko@hexco.de>2020-06-26 01:14:21 +0200
commit07fead04663b491c0a2f9053630e9a175dcbf635 (patch)
tree0fb73e9344d71279dce9384f8b9213490df2aed7 /src/afl-sharedmem.c
parent8bd8442bcc5a57a6ce5461e26cd957b343a12fc2 (diff)
downloadafl++-07fead04663b491c0a2f9053630e9a175dcbf635.tar.gz
fix shared memory leaks in afl-showmap, initialize cmplog_mode
Diffstat (limited to 'src/afl-sharedmem.c')
-rw-r--r--src/afl-sharedmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c
index 44a91a97..de0dc916 100644
--- a/src/afl-sharedmem.c
+++ b/src/afl-sharedmem.c
@@ -101,7 +101,7 @@ void afl_shm_deinit(sharedmem_t *shm) {
 u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
                  unsigned char non_instrumented_mode) {
 
-  shm->map_size = map_size;
+  shm->map_size = 0;
 
   shm->map = NULL;
 
@@ -153,7 +153,6 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
   u8 *shm_str;
 
   shm->shm_id = shmget(IPC_PRIVATE, map_size, IPC_CREAT | IPC_EXCL | 0600);
-
   if (shm->shm_id < 0) { PFATAL("shmget() failed"); }
 
   if (shm->cmplog_mode) {
@@ -204,6 +203,7 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
 
 #endif
 
+  shm->map_size = map_size;
   list_append(&shm_list, shm);
 
   return shm->map;