summaryrefslogtreecommitdiffstats
path: root/core/apk-tools/fd-leak2.patch
blob: 033bc0dc192c3851f65da33b9def30b512920a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
commit 49c904c993d39cfac7d3373c66f5b910e755f203
Author: Timo Teras <timo.teras@iki.fi>
Date:   Thu Jun 11 13:03:10 2009 +0300

    io: fix mmap bstream fd leak
    
    We need to close the fd on destruction. This is what the corresponding
    istream variant does too.

diff --git a/src/io.c b/src/io.c
index e0a9c9b..defbe46 100644
--- a/src/io.c
+++ b/src/io.c
@@ -4,7 +4,7 @@
  * Copyright (C) 2008 Timo Teräs <timo.teras@iki.fi>
  * All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it 
+ * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
  * by the Free Software Foundation. See http://www.gnu.org/ for details.
  */
@@ -257,6 +257,7 @@ static void mmap_close(void *stream, csum_t csum, size_t *size)
 		*size = mbs->size;
 
 	munmap(mbs->ptr, mbs->size);
+	close(mbs->fd);
 	free(mbs);
 }