From fb2ea18aade2ec8372121252bc6e53da7aec8df0 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Mon, 26 Dec 2022 23:34:27 +0200 Subject: [PATCH] make sure to close urandom file in jb_server_client_assign_unique_name --- server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server.c b/server.c index f887148..bf204b8 100644 --- a/server.c +++ b/server.c @@ -112,6 +112,8 @@ int jb_server_client_assign_unique_name(struct jb_server *s, int i) if (fread(&id, 1, sizeof(uint32_t), urandom_file) != sizeof(uint32_t)) { return -1; } + fclose(urandom_file); + char *name = malloc(sizeof(char) * 16); if (!name) { return -1; @@ -224,7 +226,10 @@ int jb_server_client_process_message(struct jb_server *s, int i, uint8_t *data, .data_len = data_len, }; - TRYST(wire_parse_message(&ctx, &msg)); + if (wire_parse_message(&ctx, &msg) < 0) { + printf("parsing failed\n"); + return -1; + } wire_message_field_t *destination_field = &msg.fields[DBUS_HEADER_FIELD_DESTINATION]; wire_message_field_t *member_field = &msg.fields[DBUS_HEADER_FIELD_MEMBER];