diff --git a/gobex/gobex.c b/gobex/gobex.c
index 7f85938..850e288 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
p = obex->pending_req;
+ /* Reset if final so it can no longer be cancelled */
+ if (final_rsp)
+ obex->pending_req = NULL;
+
if (p->cancelled)
err = g_error_new(G_OBEX_ERROR, G_OBEX_ERROR_CANCELLED,
"The operation was cancelled");
if (p->cancelled)
g_error_free(err);
- if (final_rsp) {
+ if (final_rsp)
pending_pkt_free(p);
- obex->pending_req = NULL;
- }
if (!disconn && g_queue_get_length(obex->tx_queue) > 0)
enable_tx(obex);