diff options
author | Alexandre Flament <alex@al-f.net> | 2021-09-28 15:26:34 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-09-28 19:28:12 +0200 |
commit | 29893cf816ab7dccaa68697d5600326b82606972 (patch) | |
tree | f99c4d26740560e9e20ac693e6a9588afc720ab4 /searx/search | |
parent | 2eab89b4ca12a404390690210f885664fa26c173 (diff) | |
download | searxng-29893cf816ab7dccaa68697d5600326b82606972.tar.gz searxng-29893cf816ab7dccaa68697d5600326b82606972.zip |
[fix] searx.network.stream: fix memory leak
Diffstat (limited to 'searx/search')
-rw-r--r-- | searx/search/checker/impl.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py index 990fd1f69..626aa8ce0 100644 --- a/searx/search/checker/impl.py +++ b/searx/search/checker/impl.py @@ -85,7 +85,10 @@ def _download_and_check_if_image(image_url: str) -> bool: }) r = next(stream) r.close() - is_image = r.headers["content-type"].startswith('image/') + if r.status_code == 200: + is_image = r.headers.get('content-type', '').startswith('image/') + else: + is_image = False del r del stream return is_image |