nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 307 forks source link

26 bytes leaked at start-up when reading the config #184

Closed nicolasff closed 3 years ago

nicolasff commented 3 years ago

@jessie-murray do you want to take this as well?

I ran your branch under Valgrind and noticed that there are a few bytes leaked when the config is read (unrelated to your PR). It's really not much (3 allocations for a total of 26 bytes and this only happens once at startup), but it could probably be addressed relatively easily.

Relevant output:

==6560== 6 bytes in 1 blocks are definitely lost in loss record 3 of 40
==6560==    at 0x483577F: malloc (vg_replace_malloc.c:299)
==6560==    by 0x4B47DB9: strdup (strdup.c:42)
==6560==    by 0x113406: conf_string_or_envvar (conf.c:53)
==6560==    by 0x113F50: acl_read_commands (conf.c:203)
==6560==    by 0x114306: conf_parse_acl (conf.c:274)
==6560==    by 0x114354: conf_parse_acls (conf.c:289)
==6560==    by 0x1139CA: conf_read (conf.c:135)
==6560==    by 0x10D36E: server_new (server.c:100)
==6560==    by 0x10B6AC: main (webdis.c:11)
==6560==
==6560== 6 bytes in 1 blocks are definitely lost in loss record 4 of 40
==6560==    at 0x483577F: malloc (vg_replace_malloc.c:299)
==6560==    by 0x4B47DB9: strdup (strdup.c:42)
==6560==    by 0x113406: conf_string_or_envvar (conf.c:53)
==6560==    by 0x113F50: acl_read_commands (conf.c:203)
==6560==    by 0x1142C3: conf_parse_acl (conf.c:269)
==6560==    by 0x114354: conf_parse_acls (conf.c:289)
==6560==    by 0x1139CA: conf_read (conf.c:135)
==6560==    by 0x10D36E: server_new (server.c:100)
==6560==    by 0x10B6AC: main (webdis.c:11)
==6560==
==6560== 14 bytes in 1 blocks are definitely lost in loss record 10 of 40
==6560==    at 0x483577F: malloc (vg_replace_malloc.c:299)
==6560==    by 0x4B47DB9: strdup (strdup.c:42)
==6560==    by 0x113406: conf_string_or_envvar (conf.c:53)
==6560==    by 0x114181: conf_parse_acl (conf.c:248)
==6560==    by 0x114354: conf_parse_acls (conf.c:289)
==6560==    by 0x1139CA: conf_read (conf.c:135)
==6560==    by 0x10D36E: server_new (server.c:100)
==6560==    by 0x10B6AC: main (webdis.c:11)

[...]

==6560== LEAK SUMMARY:
==6560==    definitely lost: 26 bytes in 3 blocks