diff mbox series

[v3,2/4] qemu-ga: Initialize correctly so getline works properly

Message ID 20241021132839.463255-8-demeng@redhat.com
State New
Headers show
Series None | expand

Commit Message

Dehan Meng Oct. 21, 2024, 1:28 p.m. UTC
Proper initialization of param 'size_t n' to '0' for
getline to function correctly.

Signed-off-by: Dehan Meng <demeng@redhat.com>
---
 qga/commands-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel P. Berrangé Oct. 21, 2024, 4:47 p.m. UTC | #1
On Mon, Oct 21, 2024 at 09:28:37PM +0800, Dehan Meng wrote:
> Proper initialization of param 'size_t n' to '0' for
> getline to function correctly.
> 
> Signed-off-by: Dehan Meng <demeng@redhat.com>
> ---
>  qga/commands-linux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/qga/commands-linux.c b/qga/commands-linux.c
index f0e9cdd27c..32bf1b8ce7 100644
--- a/qga/commands-linux.c
+++ b/qga/commands-linux.c
@@ -2126,7 +2126,7 @@  GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp)
     GuestNetworkRouteList *head = NULL, **tail = &head;
     const char *routeFiles[] = {"/proc/net/route", "/proc/net/ipv6_route"};
     FILE *fp;
-    size_t n;
+    size_t n = 0;
     char *line = NULL;
     int firstLine;
     int is_ipv6;