1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-21 18:03:41 +03:00

networkd: add missing _cleanup_ in prefix_new

This should fix a leak of the allocated Prefix if sd_radv_prefix_new
fails for some reason.

The code was already initializing prefix to NULL and using TAKE_PTR to
return it, so only the _cleanup_ was missing.

Fixes Coverity finding CID 1382976.
This commit is contained in:
Filipe Brandenburger 2018-06-07 14:37:30 -07:00 committed by Lennart Poettering
parent 9d635f50b8
commit 15b8332e7c

View File

@ -104,7 +104,7 @@ void prefix_free(Prefix *prefix) {
}
int prefix_new(Prefix **ret) {
Prefix *prefix = NULL;
_cleanup_(prefix_freep) Prefix *prefix = NULL;
prefix = new0(Prefix, 1);
if (!prefix)