network: fix memleak

If init() is failed, the allocated memory was leaked.
This commit is contained in:
Yu Watanabe 2020-07-07 12:17:46 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent c1495f8e9d
commit 58e6c62191
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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);