projects
/
project
/
ubus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
252a9b0
)
libubus: close file descriptor after sending it from a request
author
Felix Fietkau
<nbd@nbd.name>
Thu, 2 Jan 2025 11:06:53 +0000
(12:06 +0100)
committer
Felix Fietkau
<nbd@nbd.name>
Thu, 2 Jan 2025 11:24:27 +0000
(12:24 +0100)
Avoids local file descriptor leaks
Signed-off-by: Felix Fietkau <nbd@nbd.name>
libubus-req.c
patch
|
blob
|
history
diff --git
a/libubus-req.c
b/libubus-req.c
index ae9d1925ecdf1845f5d536b50240216f9ef56fb4..474aac28c69adff4195875aa0b4eeafa59ff2f3d 100644
(file)
--- a/
libubus-req.c
+++ b/
libubus-req.c
@@
-192,6
+192,8
@@
void ubus_complete_deferred_request(struct ubus_context *ctx, struct ubus_reques
blob_put_int32(&b, UBUS_ATTR_STATUS, ret);
blob_put_int32(&b, UBUS_ATTR_OBJID, req->object);
ubus_send_msg(ctx, req->seq, b.head, UBUS_MSG_STATUS, req->peer, req->fd);
+ if (req->fd >= 0)
+ close(req->fd);
}
static void ubus_put_data(struct blob_buf *buf, struct blob_attr *msg)