proc: Fix leakage of fd if element lookup failed
Fixes: CID 49002 Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
279865c18d
commit
22c83ceb1a
@ -151,7 +151,7 @@ static void proc_read(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(e = element_lookup(grp, p, 0, NULL, ELEMENT_CREAT)))
|
if (!(e = element_lookup(grp, p, 0, NULL, ELEMENT_CREAT)))
|
||||||
return;
|
goto skip;
|
||||||
|
|
||||||
if (e->e_flags & ELEMENT_FLAG_CREATED) {
|
if (e->e_flags & ELEMENT_FLAG_CREATED) {
|
||||||
if (element_set_key_attr(e, "bytes", "packets") ||
|
if (element_set_key_attr(e, "bytes", "packets") ||
|
||||||
@ -171,7 +171,7 @@ static void proc_read(void)
|
|||||||
element_notify_update(e, NULL);
|
element_notify_update(e, NULL);
|
||||||
element_lifesign(e, 1);
|
element_lifesign(e, 1);
|
||||||
}
|
}
|
||||||
|
skip:
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user