Skip to content

Commit

Permalink
Merge branch 'bugfix/KASM-2798_memory_leak' into 'master'
Browse files Browse the repository at this point in the history
Resolve KASM-2798 "Bugfix/ memory leak"

Closes KASM-2798

See merge request kasm-technologies/internal/KasmVNC!51
  • Loading branch information
mattmcclaskey committed Jun 24, 2022
2 parents 61f08d4 + 4e134b5 commit 9243299
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "kasmweb"]
path = kasmweb
url = https://github.com/kasmtech/noVNC.git
branch = feature/KASM-2634_UI_updates
branch = master
2 changes: 2 additions & 0 deletions common/network/TcpSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,8 @@ void network::createWebsocketListeners(std::list<SocketListener*> *listeners,
freeaddrinfo(ai);
throw;
}

freeaddrinfo(ai);
}
}

Expand Down
15 changes: 12 additions & 3 deletions common/network/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ void free_ws_ctx(ws_ctx_t *ctx) {
free(ctx->cout_buf);
free(ctx->tin_buf);
free(ctx->tout_buf);
free(ctx->headers);
free(ctx);
}

Expand Down Expand Up @@ -947,7 +948,8 @@ static void servefile(ws_ctx_t *ws_ctx, const char *in, const char * const user,
"Content-length: %lu\r\n"
"\r\n",
name2mime(path), filesize);
ws_send(ws_ctx, buf, strlen(buf));
const unsigned hdrlen = strlen(buf);
ws_send(ws_ctx, buf, hdrlen);

//fprintf(stderr, "http servefile output '%s'\n", buf);

Expand All @@ -957,7 +959,7 @@ static void servefile(ws_ctx_t *ws_ctx, const char *in, const char * const user,
}
fclose(f);

weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, path, strlen(buf) + filesize);
weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, path, hdrlen + filesize);

return;
nope:
Expand Down Expand Up @@ -1947,7 +1949,14 @@ void *start_server(void *unused) {
pthread_t tid;
pass->id = settings.handler_id;
pass->csock = csock;
pthread_create(&tid, NULL, subthread, pass);

pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

pthread_create(&tid, &attr, subthread, pass);

pthread_attr_destroy(&attr);

settings.handler_id += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion kasmweb
Submodule kasmweb updated 1 files
+6 −0 app/ui.js

0 comments on commit 9243299

Please sign in to comment.