Skip to content

Commit 89e1a72

Browse files
committed
L: fix double free
1 parent a8aeb66 commit 89e1a72

File tree

4 files changed

+2
-8
lines changed

4 files changed

+2
-8
lines changed

general/lib/socket/socket.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,6 @@ int socket_send_error_to_client(char *path, char *buf, struct ThreadArgs *args)
320320
int err = protocol_response('3', buf, path, "localhost", args->configs.port_number, &m);
321321
if (err != 0) {
322322
clean_request(path, buf, args);
323-
} else {
324-
socket_send_message(args->fd, m);
325-
if (m != NULL) {
326-
free(m);
327-
}
328323
}
329324

330325
socket_send_message(args->fd, m);

gopher_log_file.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10000,3 +10000,4 @@ L-> FileName: /opt/local_projects/gopher-project/README.md 124 Byte IP Client
1000010000
L-> FileName: /opt/local_projects/gopher-project/main.c 5041 Byte IP Client: 127.0.0.1 cloud.valerioneri.com Port: 7080
1000110001
W -> FileName: C:\Projects\gopher3\gopher-project\/windows/keep.sh 4 KByte IP Client: 192.168.1.27 Port: 7080
1000210002
L-> FileName: /opt/local_projects/gopher-project/README.md 124 Byte IP Client: 127.0.0.1 cloud.valerioneri.com Port: 7080
10003+
L->

linux/lib/socket/linux_socket.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ int linux_socket(struct Configs *configs) {
210210
perror("linux_socket.c/linux_socket unable to run run_concurrency");
211211
continue;
212212
}
213-
214213
vlog_ut(1, "%s\n", "Accepted request");
215214

216215
}

main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
156156

157157
start_mutex();
158158

159-
while (true) {
159+
while(true){
160160

161161
log_ut("conf root dir %s\n", configs->root_dir);
162162
linux_socket(configs);
@@ -166,7 +166,6 @@ int main(int argc, char *argv[]) {
166166
configs->reset_config = NULL;
167167
//free(configs->root_dir);
168168
conf_parseConfigFile("../gopher_server_configuration.txt", configs);
169-
170169
}
171170
log_ut("close server");
172171
close_mutex();

0 commit comments

Comments
 (0)