From d5c9c6e1eadfe8267375452e77aad3b14338b6c1 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> Date: Wed, 29 Dec 2021 14:10:53 +0100 Subject: [PATCH] Silence compiler warnings [-Wdiscarded-qualifiers] It's just a quirk that free takes non-const: it doesn't actually modify the value pointed to, either conceptually or in practice, it merely looks up the memory block using the pointer and deallocates it. Unfortunately, the compiler will emit warning when attempting to free() a "const char *". So either switch to a pointer to non-const or cast to (void *) when calling free() on a pointer to const. Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> --- wintun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wintun.c b/wintun.c index 5c544ab2..b848579f 100644 --- a/wintun.c +++ b/wintun.c @@ -169,7 +169,7 @@ int os_read_wintun(struct openconnect_info *vpninfo, struct pkt *pkt) if (!tun_pkt) { DWORD err = GetLastError(); if (err != ERROR_NO_MORE_ITEMS) { - const char *errstr = openconnect__win32_strerror(err); + char *errstr = openconnect__win32_strerror(err); vpn_progress(vpninfo, PRG_ERR, _("Could not retrieve packet from Wintun adapter '%S': %s\n"), vpninfo->ifname_w, errstr); free(errstr); @@ -196,7 +196,7 @@ int os_write_wintun(struct openconnect_info *vpninfo, struct pkt *pkt) pkt->len); if (!tun_pkt) { DWORD err = GetLastError(); - const char *errstr = openconnect__win32_strerror(err); + char *errstr = openconnect__win32_strerror(err); vpn_progress(vpninfo, PRG_ERR, _("Could not send packet through Wintun adapter '%S': %s\n"), vpninfo->ifname_w, errstr); free(errstr); -- 2.50.1