diff options
author | steven_carr <steven_carr> | 2006-05-28 20:38:26 +0000 |
---|---|---|
committer | steven_carr <steven_carr> | 2006-05-28 20:38:26 +0000 |
commit | 1955526d45fd151551af4384b7d58515fea67f84 (patch) | |
tree | d92fc57bac94fa8c8a5b5c9d53798aa2ab5dec70 /libvncserver/ultra.c | |
parent | 2fa31ba4ea2581ea0886ec35daa4a19ca55e234d (diff) | |
download | libtdevnc-1955526d45fd151551af4384b7d58515fea67f84.tar.gz libtdevnc-1955526d45fd151551af4384b7d58515fea67f84.zip |
Plugged some memory leakage
Diffstat (limited to 'libvncserver/ultra.c')
-rw-r--r-- | libvncserver/ultra.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libvncserver/ultra.c b/libvncserver/ultra.c index 1e51446..a802026 100644 --- a/libvncserver/ultra.c +++ b/libvncserver/ultra.c @@ -23,7 +23,7 @@ static char *lzoBeforeBuf = NULL; static int lzoAfterBufSize = 0; static char *lzoAfterBuf = NULL; -static int lzoAfterBufLen; +static int lzoAfterBufLen = 0; /* * rfbSendOneRectEncodingZlib - send a given rectangle using one Zlib @@ -32,6 +32,26 @@ static int lzoAfterBufLen; #define MAX_WRKMEM ((LZO1X_1_MEM_COMPRESS) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) +void rfbUltraCleanup(rfbScreenInfoPtr screen) +{ + if (lzoBeforeBufSize) { + free(lzoBeforeBuf); + lzoBeforeBufSize=0; + } + if (lzoAfterBufSize) { + free(lzoAfterBuf); + lzoAfterBufSize=0; + } +} + +void rfbFreeUltraData(rfbClientPtr cl) { + if (cl->compStreamInitedLZO) { + free(cl->lzoWrkMem); + cl->compStreamInitedLZO=FALSE; + } +} + + static rfbBool rfbSendOneRectEncodingUltra(rfbClientPtr cl, int x, @@ -125,6 +145,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl, memcpy(&cl->updateBuf[cl->ublen], (char *)&hdr, sz_rfbZlibHeader); cl->ublen += sz_rfbZlibHeader; + /* We might want to try sending the data directly... */ for (i = 0; i < lzoAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen; |