From 9ef345fdd0eff7b779cea8bb6e8c3acd65e084a9 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 3 Mar 2019 00:01:16 +0100 Subject: [PATCH] Make owned serial a pointer-to-non-const The server owns the serial, so it needs to free it. Therefore, it should not be a pointer-to-const. --- app/src/server.c | 8 ++++---- app/src/server.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/server.c b/app/src/server.c index 6f23d8af..972fbbaa 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -172,12 +172,12 @@ server_start(struct server *server, const char *serial, } if (!push_server(serial)) { - SDL_free((void *) server->serial); + SDL_free(server->serial); return false; } if (!enable_tunnel(server)) { - SDL_free((void *) server->serial); + SDL_free(server->serial); return false; } @@ -195,7 +195,7 @@ server_start(struct server *server, const char *serial, if (server->server_socket == INVALID_SOCKET) { LOGE("Could not listen on port %" PRIu16, local_port); disable_tunnel(server); - SDL_free((void *) server->serial); + SDL_free(server->serial); return false; } } @@ -271,5 +271,5 @@ server_destroy(struct server *server) { if (server->device_socket != INVALID_SOCKET) { close_socket(&server->device_socket); } - SDL_free((void *) server->serial); + SDL_free(server->serial); } diff --git a/app/src/server.h b/app/src/server.h index 61e0311f..0f25d48f 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -8,7 +8,7 @@ #include "net.h" struct server { - const char *serial; + char *serial; process_t process; socket_t server_socket; // only used if !tunnel_forward socket_t device_socket;