summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2021-04-19 22:36:24 +0200
committerDirk Engling <erdgeist@erdgeist.org>2021-04-19 22:36:24 +0200
commit00bd3b20099e921c251cb791192b03a8d24a4a2c (patch)
tree6eba55ec8a25ea52fdb89421ba9af6850b8f2593
parent102ba9075b8df32627f38074a293d804e04139ba (diff)
unmap file if a memory allocation error occurs
-rw-r--r--ot_accesslist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ot_accesslist.c b/ot_accesslist.c
index 2e3778f..48de873 100644
--- a/ot_accesslist.c
+++ b/ot_accesslist.c
@@ -56,8 +56,9 @@ static void accesslist_readfile( void ) {
56 for the maximum amount of them */ 56 for the maximum amount of them */
57 accesslist_new->size = 0; 57 accesslist_new->size = 0;
58 info_hash = accesslist_new->list = malloc( ( maplen / 41 ) * 20 ); 58 info_hash = accesslist_new->list = malloc( ( maplen / 41 ) * 20 );
59 if( !accesslist_new ) { 59 if( !accesslist_new->list ) {
60 fprintf( stderr, "Warning: Not enough memory to allocate %zd bytes for accesslist buffer. May succeed later.\n", ( maplen / 41 ) * 20 ); 60 fprintf( stderr, "Warning: Not enough memory to allocate %zd bytes for accesslist buffer. May succeed later.\n", ( maplen / 41 ) * 20 );
61 mmap_unmap( map, maplen);
61 free(accesslist_new); 62 free(accesslist_new);
62 return; 63 return;
63 } 64 }