summary refs log tree commit diff stats
path: root/qga/commands-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'qga/commands-linux.c')
-rw-r--r--qga/commands-linux.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/qga/commands-linux.c b/qga/commands-linux.c
index b0704ad423..cf077eb03d 100644
--- a/qga/commands-linux.c
+++ b/qga/commands-linux.c
@@ -2138,7 +2138,6 @@ GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp)
         fp = fopen(route_files[i], "r");
         if (fp == NULL) {
             error_setg_errno(errp, errno, "open(\"%s\")", route_files[i]);
-            free(line);
             continue;
         }
 
@@ -2212,9 +2211,9 @@ GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp)
             route = NULL;
         }
 
-        free(line);
         fclose(fp);
     }
 
+    free(line);
     return head;
 }