mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-06 01:40:22 -05:00
selection: free strdup:ed clipboard data on fdm failure
This commit is contained in:
parent
8824e3823e
commit
1207ad1502
1 changed files with 4 additions and 0 deletions
|
|
@ -364,6 +364,8 @@ send(void *data, struct wl_data_source *wl_data_source, const char *mime_type,
|
||||||
const char *selection = clipboard->text;
|
const char *selection = clipboard->text;
|
||||||
const size_t len = strlen(selection);
|
const size_t len = strlen(selection);
|
||||||
|
|
||||||
|
/* Make it NONBLOCK:ing right away - we don't want to block if the
|
||||||
|
* initial attempt to send the data synchronously fails */
|
||||||
int flags;
|
int flags;
|
||||||
if ((flags = fcntl(fd, F_GETFL)) < 0 ||
|
if ((flags = fcntl(fd, F_GETFL)) < 0 ||
|
||||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
|
fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
|
||||||
|
|
@ -384,6 +386,7 @@ send(void *data, struct wl_data_source *wl_data_source, const char *mime_type,
|
||||||
if (fdm_add(wayl->fdm, fd, EPOLLOUT, &fdm_send, ctx))
|
if (fdm_add(wayl->fdm, fd, EPOLLOUT, &fdm_send, ctx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
free(ctx->data);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -474,6 +477,7 @@ primary_send(void *data,
|
||||||
if (fdm_add(wayl->fdm, fd, EPOLLOUT, &fdm_send, ctx))
|
if (fdm_add(wayl->fdm, fd, EPOLLOUT, &fdm_send, ctx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
free(ctx->data);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue