From: Sascha Silbe <sascha@silbe.org>
Subject: [PATCH] fix file descriptor leak in filestore.retrieve()
Fix file descriptor leak in filestore.retrieve().
Minimally invasive version.
Signed-off-by: Sascha Silbe <sascha@silbe.org>
---
src/carquinyol/filestore.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/carquinyol/filestore.py b/src/carquinyol/filestore.py
index 5a90a8e..b0a389b 100644
a
|
b
|
class FileStore(object): |
115 | 115 | attempt = 1 |
116 | 116 | while os.path.exists(destination_path): |
117 | 117 | if attempt > 10: |
118 | | fd_, destination_path = tempfile.mkstemp(prefix=uid, |
119 | | suffix=extension, |
120 | | dir=destination_dir) |
121 | | del fd_ |
| 118 | fd, destination_path = tempfile.mkstemp(prefix=uid, |
| 119 | suffix=extension, dir=destination_dir) |
| 120 | os.close(fd) |
122 | 121 | os.unlink(destination_path) |
123 | 122 | break |
124 | 123 | else: |