Skip to content

Commit 13235a0

Browse files
committed
Fix FD leak.
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45889 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent 2f6a7af commit 13235a0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

vice/src/userport/userport_wic64.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,9 @@ static void http_get_alarm_handler(CLOCK offset, void *data)
10781078
remote_to = wic64_remote_timeout;
10791079

10801080
msg = curl_multi_info_read(cm, &msgs_left);
1081+
if (msgs_left > 0) {
1082+
wic64_log(LOG_COL_LRED, "%s, msgs_left: %d (>0! not handled), msg = %p", __FUNCTION__, msgs_left, msg);
1083+
}
10811084
if (msg) {
10821085
CURLcode res;
10831086
res = curl_easy_getinfo(msg->easy_handle,
@@ -1096,6 +1099,8 @@ static void http_get_alarm_handler(CLOCK offset, void *data)
10961099
curl_easy_strerror(res));
10971100
url = "<unknown>";
10981101
}
1102+
} else {
1103+
wic64_log(LOG_COL_LRED, "%s, msgs_left: %d, msg = %p!", __FUNCTION__, msgs_left, msg);
10991104
}
11001105

11011106
if (response == 201) {
@@ -1138,6 +1143,11 @@ static void http_get_alarm_handler(CLOCK offset, void *data)
11381143
}
11391144

11401145
out:
1146+
if (msg) {
1147+
/* cleanup easy handly, fixes FD leak */
1148+
curl_multi_remove_handle(cm, msg->easy_handle);
1149+
curl_easy_cleanup(msg->easy_handle);
1150+
}
11411151
curl_multi_cleanup(cm);
11421152
curl_global_cleanup();
11431153
alarm_unset(http_get_alarm);

0 commit comments

Comments
 (0)