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.
This commit is contained in:
Romain Vimont 2019-03-03 00:01:16 +01:00
parent dfed1b250e
commit 9ef345fdd0
2 changed files with 5 additions and 5 deletions

View file

@ -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);
}

View file

@ -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;