aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-09-10 14:41:31 +0200
committerMax Reitz <mreitz@redhat.com>2019-09-16 15:31:11 +0200
commit007f339b1099af46a008dac438ca0943e31dba72 (patch)
treed679c6144fd0d7e9cf9967759e71fc5afbe3319e /block
parent0487861685294660b23bc146e1ebd5304aa8bbe0 (diff)
downloadqemu-007f339b1099af46a008dac438ca0943e31dba72.zip
qemu-007f339b1099af46a008dac438ca0943e31dba72.tar.gz
qemu-007f339b1099af46a008dac438ca0943e31dba72.tar.bz2
curl: Keep *socket until the end of curl_sock_cb()
This does not really change anything, but it makes the code a bit easier to follow once we use @socket as the opaque pointer for aio_set_fd_handler(). Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20190910124136.10565-3-mreitz@redhat.com Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/curl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/curl.c b/block/curl.c
index 92dc2f6..95d7b77 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -172,10 +172,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
QLIST_FOREACH(socket, &state->sockets, next) {
if (socket->fd == fd) {
- if (action == CURL_POLL_REMOVE) {
- QLIST_REMOVE(socket, next);
- g_free(socket);
- }
break;
}
}
@@ -185,7 +181,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
socket->state = state;
QLIST_INSERT_HEAD(&state->sockets, socket, next);
}
- socket = NULL;
trace_curl_sock_cb(action, (int)fd);
switch (action) {
@@ -207,6 +202,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
break;
}
+ if (action == CURL_POLL_REMOVE) {
+ QLIST_REMOVE(socket, next);
+ g_free(socket);
+ }
+
return 0;
}