If server.users refers to an existing file which is not a ssh public
key, we leak 4 bytes of memory:
==27302== 4 bytes in 1 blocks are definitely lost in loss record 1 of 8
==27302== at 0x402C201: malloc (vg_replace_malloc.c:299)
==27302== by 0x8052FF3: para_malloc (string.c:63)
==27302== by 0x8066532: get_public_key (crypt.c:151)
==27302== by 0x80569D1: user_list_init (user_list.c:90)
==27302== by 0x804D74D: parse_config_or_die (server.c:279)
==27302== by 0x804C719: server_init (server.c:554)
==27302== by 0x804C719: main (server.c:655)
Furtunately, this issue is trivial to fix.
goto out;
ret = is_ssh_rsa_key(map, map_size);
if (!ret) {
- para_munmap(map, map_size);
- return -E_SSH_PARSE;
+ ret = -E_SSH_PARSE;
+ goto out_unmap;
}
cp = map + ret;
encoded_size = map_size - ret;