Message ID | 8caac123-9d45-c848-d45a-3cb8be5a2708@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix serverl issues reported by Coverity | expand |
Zhiqiang Liu <liuzhiqiang26@huawei.com> writes: > In add_bus(), bus->bus_path is set by calling parent_dev_path(), > which will finally adopt realpath(, NULL) to allocate new path. > However, bus->bus_path will not be freed in err_read tag, then, > memory leakage occurs. > > Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> > --- > ndctl/lib/libndctl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c > index ad521d3..3926382 100644 > --- a/ndctl/lib/libndctl.c > +++ b/ndctl/lib/libndctl.c > @@ -975,6 +975,7 @@ static void *add_bus(void *parent, int id, const char *ctl_base) > free(bus->wait_probe_path); > free(bus->scrub_path); > free(bus->provider); > + free(bus->bus_path); > free(bus->bus_buf); > free(bus); > err_bus: Acked-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index ad521d3..3926382 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -975,6 +975,7 @@ static void *add_bus(void *parent, int id, const char *ctl_base) free(bus->wait_probe_path); free(bus->scrub_path); free(bus->provider); + free(bus->bus_path); free(bus->bus_buf); free(bus); err_bus:
In add_bus(), bus->bus_path is set by calling parent_dev_path(), which will finally adopt realpath(, NULL) to allocate new path. However, bus->bus_path will not be freed in err_read tag, then, memory leakage occurs. Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> --- ndctl/lib/libndctl.c | 1 + 1 file changed, 1 insertion(+)