Minor memory leaks found with valgrind

This commit is contained in:
matt335672
2021-10-21 15:24:39 +01:00
parent 0c605a3cc4
commit 15b7f18ede
2 changed files with 11 additions and 22 deletions
+1
View File
@@ -1107,6 +1107,7 @@ vnc_clip_open_clip_channel(struct vnc *v)
s_mark_end(s); s_mark_end(s);
send_stream_to_clip_channel(v, s); send_stream_to_clip_channel(v, s);
free_stream(s);
/* Need to complete the startup handshake before we send formats */ /* Need to complete the startup handshake before we send formats */
v->vc->startup_complete = 1; v->vc->startup_complete = 1;
} }
+10 -22
View File
@@ -120,8 +120,8 @@ xrdp_cache_create(struct xrdp_wm *owner,
} }
/*****************************************************************************/ /*****************************************************************************/
void static void
xrdp_cache_delete(struct xrdp_cache *self) clear_all_cached_items(struct xrdp_cache *self)
{ {
int i; int i;
int j; int j;
@@ -165,7 +165,13 @@ xrdp_cache_delete(struct xrdp_cache *self)
list16_deinit(&(self->crc16[i][j])); list16_deinit(&(self->crc16[i][j]));
} }
} }
}
/*****************************************************************************/
void
xrdp_cache_delete(struct xrdp_cache *self)
{
clear_all_cached_items(self);
g_free(self); g_free(self);
} }
@@ -176,30 +182,12 @@ xrdp_cache_reset(struct xrdp_cache *self,
{ {
struct xrdp_wm *wm; struct xrdp_wm *wm;
struct xrdp_session *session; struct xrdp_session *session;
int i;
int j;
/* free all the cached bitmaps */
for (i = 0; i < XRDP_MAX_BITMAP_CACHE_ID; i++)
{
for (j = 0; j < XRDP_MAX_BITMAP_CACHE_IDX; j++)
{
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
}
}
/* free all the cached font items */
for (i = 0; i < 12; i++)
{
for (j = 0; j < 256; j++)
{
g_free(self->char_items[i][j].font_item.data);
}
}
/* save these */ /* save these */
wm = self->wm; wm = self->wm;
session = self->session; session = self->session;
/* De-allocate any allocated memory */
clear_all_cached_items(self);
/* set whole struct to zero */ /* set whole struct to zero */
g_memset(self, 0, sizeof(struct xrdp_cache)); g_memset(self, 0, sizeof(struct xrdp_cache));
/* set some stuff back */ /* set some stuff back */