Message ID | 20241021132839.463255-9-demeng@redhat.com |
---|---|
State | New |
Headers | show |
Series | None | expand |
On Mon, Oct 21, 2024 at 09:28:38PM +0800, Dehan Meng wrote: > It's now only freed at the end of the function. > > Signed-off-by: Dehan Meng <demeng@redhat.com> > --- > qga/commands-linux.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> With regards, Daniel
diff --git a/qga/commands-linux.c b/qga/commands-linux.c index 32bf1b8ce7..c6bda78de6 100644 --- a/qga/commands-linux.c +++ b/qga/commands-linux.c @@ -2137,8 +2137,7 @@ GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp) is_ipv6 = (i == 1); fp = fopen(routeFiles[i], "r"); if (fp == NULL) { - error_setg_errno(errp, errno, "open(\"%s\")", routeFiles[i]); - free(line); + error_setg_errno(errp, errno, "open(\"%s\")", route_files[i]); continue; } @@ -2226,9 +2225,8 @@ GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp) QAPI_LIST_APPEND(tail, route); } - free(line); fclose(fp); } - + free(line); return head; }
It's now only freed at the end of the function. Signed-off-by: Dehan Meng <demeng@redhat.com> --- qga/commands-linux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)