Closed vmihalko closed 1 year ago
In GitLab by @halfline on Aug 11, 2021, 04:23
Commented on src/polkitbackend/polkitbackendjsauthority.cpp line 1735
this needs to be null initialized if you're going to free it unconditionally i think
In GitLab by @halfline on Aug 11, 2021, 04:29
i think this is probably a false positive to be honest. i doubt buf will ever get touched unless the condition evaluates to true.
could use g_autofree i suppose
In GitLab by @jrybar on Aug 11, 2021, 10:16
Commented on src/polkitbackend/polkitbackendjsauthority.cpp line 1735
true
In GitLab by @jrybar on Aug 11, 2021, 10:18
I thought the very same at first (and with this in mind I closed the related bugzilla), but then I realized that if the _read_to_end() ends prematurely with an error, the allocated memory pointed by *buf does not get wiped (as it's only freed if condition succeeds). According to the scarse documentation I was able to find, nothing says this is sanitized. On the other hand g_free() simply returns if *buf is already null, so there's nothing to lose.
In GitLab by @jrybar on Aug 12, 2021, 14:30
OK, after seeing the code of giochannel.c, I can confirm that the Glib function returns safe output, hence this can be really closed as false positive.
In GitLab by @jrybar on Aug 10, 2021, 18:16
Merges covscan-jsauthority-memleak -> master
Detection found by static analysis