diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-08-03 18:48:36 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-08-03 18:48:36 +0200 |
commit | 6fa47d8acc71079130a4f02a0dc5becaadb9446d (patch) | |
tree | b886eae168ed3222cc84f484714e16b46e3b91b1 /src | |
parent | 1181f79edafa099b8b935a3c49cb3d3b35482662 (diff) |
-fix FD leak
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_spa.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/taler-merchant-httpd_spa.c b/src/backend/taler-merchant-httpd_spa.c index 1c095333..b12200b8 100644 --- a/src/backend/taler-merchant-httpd_spa.c +++ b/src/backend/taler-merchant-httpd_spa.c @@ -118,13 +118,7 @@ static enum GNUNET_GenericReturnValue build_webui (void *cls, const char *dn) { - int fd; - struct stat sb; - struct MHD_Response *zspa = NULL; - struct MHD_Response *spa; - const char *ext; - const char *mime; - struct + static struct { const char *ext; const char *mime; @@ -162,6 +156,12 @@ build_webui (void *cls, .mime = NULL }, }; + int fd; + struct stat sb; + struct MHD_Response *zspa = NULL; + struct MHD_Response *spa; + const char *ext; + const char *mime; (void) cls; /* finally open template */ @@ -188,8 +188,10 @@ build_webui (void *cls, mime = NULL; ext = strrchr (dn, '.'); if (NULL == ext) + { + GNUNET_break (0 == close (fd)); return GNUNET_OK; - + } ext++; for (unsigned int i = 0; NULL != mime_map[i].ext; i++) if (0 == strcasecmp (ext, |