From: Yu Watanabe Date: Tue, 7 Jul 2020 03:17:46 +0000 (+0900) Subject: network: fix memleak X-Git-Tag: v246-rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58e6c6219154986d5103c8d3db6a58ac0e3420af;p=thirdparty%2Fsystemd.git network: fix memleak If init() is failed, the allocated memory was leaked. --- diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c index 91cdd8917f5..c2b6c1de2fb 100644 --- a/src/network/tc/qdisc.c +++ b/src/network/tc/qdisc.c @@ -39,7 +39,7 @@ const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = { }; static int qdisc_new(QDiscKind kind, QDisc **ret) { - QDisc *qdisc; + _cleanup_(qdisc_freep) QDisc *qdisc = NULL; int r; if (kind == _QDISC_KIND_INVALID) { diff --git a/src/network/tc/tclass.c b/src/network/tc/tclass.c index 4f75e1b42dc..a89e7757ad0 100644 --- a/src/network/tc/tclass.c +++ b/src/network/tc/tclass.c @@ -22,7 +22,7 @@ const TClassVTable * const tclass_vtable[_TCLASS_KIND_MAX] = { }; static int tclass_new(TClassKind kind, TClass **ret) { - TClass *tclass; + _cleanup_(tclass_freep) TClass *tclass = NULL; int r; tclass = malloc0(tclass_vtable[kind]->object_size);