make sure to close urandom file in jb_server_client_assign_unique_name
This commit is contained in:
parent
e20e5ff3af
commit
fb2ea18aad
1 changed files with 6 additions and 1 deletions
7
server.c
7
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];
|
||||
|
|
Loading…
Reference in a new issue