1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 21:25:42 +02:00

api: fix file descriptor leak in hook_url (closes #2284)

This can happen after a timeout or if the hook is removed during the transfer.
This commit is contained in:
Sébastien Helleu
2025-11-15 17:19:42 +01:00
parent 898213b4f2
commit 3e49b73117
6 changed files with 164 additions and 40 deletions
+1
View File
@@ -37,6 +37,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
### Fixed
- core: display an error message in case of invalid parameters in commands /bar, /buffer, /cursor, /print and /window
- api: fix file descriptor leak in hook_url when a timeout occurs or if the hook is removed during the transfer ([#2284](https://github.com/weechat/weechat/issues/2284))
- api: fix parsing of date/times with timezone offset in function util_parse_time
- irc: fix warning on creation of irc.msgbuffer option when the server name contains upper case letters ([#2281](https://github.com/weechat/weechat/issues/2281))
- irc: display a warning for each unknown or invalid server option in commands /connect and /server
+121 -29
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -24,6 +24,8 @@
#include <stdio.h>
#define URL_ERROR_TIMEOUT "transfer timeout reached"
struct t_hashtable;
struct t_infolist;
@@ -61,7 +63,8 @@ extern char *url_type_string[];
extern struct t_url_option url_options[];
extern int weeurl_download (const char *url, struct t_hashtable *options,
struct t_hashtable *output);
long timeout, struct t_hashtable *output,
int *stop_transfer);
extern int weeurl_option_add_to_infolist (struct t_infolist *infolist,
struct t_url_option *option);
extern void weeurl_init (void);
+3 -1
View File
@@ -280,7 +280,9 @@ hook_process_child (struct t_hook *hook_process)
}
rc = weeurl_download (ptr_url,
HOOK_PROCESS(hook_process, options),
NULL); /* output */
0, /* timeout */
NULL, /* output */
NULL); /* stop_download */
}
else if (strncmp (HOOK_PROCESS(hook_process, command), "func:", 5) == 0)
{
File diff suppressed because it is too large Load Diff
+1
View File
@@ -41,6 +41,7 @@ struct t_hook_url
char *url; /* URL */
struct t_hashtable *options; /* URL options (see doc) */
long timeout; /* timeout (ms) (0 = no timeout) */
int stop_transfer; /* 1 is used to stop transfer now */
pthread_t thread_id; /* thread id */
int thread_created; /* thread created */
int thread_running; /* 1 if thread is running */