summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/file.c6
-rw-r--r--common/log.c2
-rw-r--r--keygen/keygen.c5
-rw-r--r--libxrdp/libxrdp.c6
-rw-r--r--libxrdp/xrdp_iso.c1
-rw-r--r--libxrdp/xrdp_rdp.c4
-rw-r--r--libxrdp/xrdp_sec.c14
-rw-r--r--sesman/chansrv/chansrv_fuse.c18
-rw-r--r--sesman/chansrv/chansrv_fuse.h2
-rw-r--r--sesman/chansrv/devredir.c9
-rw-r--r--sesman/chansrv/rail.c1
-rw-r--r--sesman/chansrv/smartcard.c5
-rw-r--r--sesman/chansrv/smartcard_pcsc.c2
-rw-r--r--sesman/chansrv/sound.c3
-rw-r--r--sesman/libscp/libscp_v1c.c1
-rw-r--r--sesman/libscp/libscp_v1c_mng.c2
-rw-r--r--sesman/scp_v1.c3
-rw-r--r--sesman/session.c6
-rw-r--r--sesman/sig.c1
-rw-r--r--sesman/tools/sesadmin.c10
-rw-r--r--xrdp/lang.c2
-rw-r--r--xrdp/xrdp_listen.c5
-rw-r--r--xrdp/xrdp_mm.c10
-rw-r--r--xrdp/xrdp_wm.c5
24 files changed, 80 insertions, 43 deletions
diff --git a/common/file.c b/common/file.c
index a9a06de9..b51a37cc 100644
--- a/common/file.c
+++ b/common/file.c
@@ -233,7 +233,7 @@ l_file_read_section(int fd, int max_file_size, const char *section,
int len;
int index;
int file_size;
-
+
data = (char *) g_malloc(FILE_MAX_LINE_BYTES * 3, 0);
text = data;
name = text + FILE_MAX_LINE_BYTES;
@@ -364,7 +364,7 @@ file_by_name_read_sections(const char *file_name, struct list *names)
fd = g_file_open(file_name);
- if (fd < 1)
+ if (fd < 0)
{
return 1;
}
@@ -405,7 +405,7 @@ file_by_name_read_section(const char *file_name, const char *section,
fd = g_file_open(file_name);
- if (fd < 1)
+ if (fd < 0)
{
return 1;
}
diff --git a/common/log.c b/common/log.c
index 54dfaa29..d7594d67 100644
--- a/common/log.c
+++ b/common/log.c
@@ -284,6 +284,7 @@ internalReadConfiguration(const char *inFilename, const char *applicationName)
if (ret != LOG_STARTUP_OK)
{
+ g_file_close(fd);
return ret;
}
@@ -301,6 +302,7 @@ internalReadConfiguration(const char *inFilename, const char *applicationName)
if (ret != LOG_STARTUP_OK)
{
+ g_file_close(fd);
return ret;
}
diff --git a/keygen/keygen.c b/keygen/keygen.c
index bd47f73a..0cd1427d 100644
--- a/keygen/keygen.c
+++ b/keygen/keygen.c
@@ -217,7 +217,7 @@ sign_key(char *e_data, int e_len, char *n_data, int n_len,
{
return 1;
}
-
+
if (n_len == 64)
{
key = (char *)g_malloc(184, 0);
@@ -367,11 +367,12 @@ save_all(char *e_data, int e_len, char *n_data, int n_len,
fd = g_file_open(filename);
- if (fd > 0)
+ if (fd != -1)
{
if (g_file_write(fd, "[keys]\n", 7) == -1)
{
g_writeln("problem writing to %s, maybe no rights", filename);
+ g_file_close(fd);
return 1;
}
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index e9c3508b..e5b921c0 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -308,15 +308,18 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
}
DEBUG(("libxrdp_send_palette sending palette"));
+
/* clear orders */
libxrdp_orders_force_send(session);
make_stream(s);
init_stream(s, 8192);
+
if (session->client_info->use_fast_path & 1) /* fastpath output supported */
{
LLOGLN(10, ("libxrdp_send_palette: fastpath"));
if (xrdp_rdp_init_fastpath((struct xrdp_rdp *)session->rdp, s) != 0)
{
+ free_stream(s);
return 1;
}
}
@@ -345,6 +348,7 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
FASTPATH_UPDATETYPE_PALETTE) != 0)
{
+ free_stream(s);
return 1;
}
}
@@ -354,6 +358,7 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
RDP_DATA_PDU_UPDATE);
}
free_stream(s);
+
/* send the orders palette too */
libxrdp_orders_init(session);
libxrdp_orders_send_palette(session, palette, 0);
@@ -775,6 +780,7 @@ libxrdp_set_pointer(struct xrdp_session *session, int cache_idx)
if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
FASTPATH_UPDATETYPE_CACHED) != 0)
{
+ free_stream(s);
return 1;
}
}
diff --git a/libxrdp/xrdp_iso.c b/libxrdp/xrdp_iso.c
index 633dc5a9..6fb803ad 100644
--- a/libxrdp/xrdp_iso.c
+++ b/libxrdp/xrdp_iso.c
@@ -226,6 +226,7 @@ xrdp_iso_send_cc(struct xrdp_iso *self)
if (trans_force_write_s(self->trans, s) != 0)
{
+ free_stream(s);
return 1;
}
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 3719b015..2cc7c28b 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -705,7 +705,8 @@ xrdp_rdp_send_data_update_sync(struct xrdp_rdp *self)
LLOGLN(10, ("xrdp_rdp_send_data_update_sync: fastpath"));
if (xrdp_rdp_init_fastpath(self, s) != 0)
{
- return 1;
+ free_stream(s);
+ return 1;
}
}
else /* slowpath */
@@ -727,6 +728,7 @@ xrdp_rdp_send_data_update_sync(struct xrdp_rdp *self)
if (xrdp_rdp_send_fastpath(self, s,
FASTPATH_UPDATETYPE_SYNCHRONIZE) != 0)
{
+ free_stream(s);
return 1;
}
}
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index d726f3e8..6ebdf715 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -771,7 +771,7 @@ xrdp_sec_send_media_lic_response(struct xrdp_sec *self)
/*****************************************************************************/
static void APP_CC
-xrdp_sec_rsa_op(struct xrdp_sec *self, char *out, char *in, int in_bytes,
+xrdp_sec_rsa_op(struct xrdp_sec *self, char *out, char *in, int in_bytes,
char *mod, char *exp)
{
ssl_mod_exp(out, self->rsa_key_bytes, in, in_bytes,
@@ -1616,7 +1616,6 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
{
int num_channels;
int index;
- struct mcs_channel_item *channel_item;
DEBUG(("processing channels, channel_code is %d", self->channel_code));
@@ -1641,16 +1640,19 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
for (index = 0; index < num_channels; index++)
{
+ struct mcs_channel_item *channel_item;
+
channel_item = (struct mcs_channel_item *)
g_malloc(sizeof(struct mcs_channel_item), 1);
if (!s_check_rem(s, 12))
{
+ g_free(channel_item);
return 1;
}
in_uint8a(s, channel_item->name, 8);
in_uint32_le(s, channel_item->flags);
channel_item->chanid = MCS_GLOBAL_CHANNEL + (index + 1);
- list_add_item(self->mcs_layer->channel_list, (tintptr)channel_item);
+ list_add_item(self->mcs_layer->channel_list, (tintptr) channel_item);
DEBUG(("got channel flags %8.8x name %s", channel_item->flags,
channel_item->name));
}
@@ -1852,7 +1854,7 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
gcc_size_ptr = s->p; /* RDPGCCUserDataResponseLength */
out_uint8s(s, 2);
ud_ptr = s->p; /* User Data */
-
+
out_uint16_le(s, SEC_TAG_SRV_INFO);
if (self->mcs_layer->iso_layer->selectedProtocol != -1)
{
@@ -1866,7 +1868,7 @@ xrdp_sec_out_mcs_data(struct xrdp_sec *self)
out_uint8(s, 0);
out_uint8(s, 8);
out_uint8(s, 0);
- if (self->mcs_layer->iso_layer->selectedProtocol != -1)
+ if (self->mcs_layer->iso_layer->selectedProtocol != -1)
{
/* ReqeustedProtocol */
out_uint32_le(s, self->mcs_layer->iso_layer->selectedProtocol);
@@ -2060,7 +2062,7 @@ xrdp_sec_incoming(struct xrdp_sec *self)
{
item = (char *)list_get_item(items, index);
value = (char *)list_get_item(values, index);
-
+
if (g_strcasecmp(item, "pub_exp") == 0)
{
hex_str_to_bin(value, self->pub_exp, 4);
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 3ec00b6e..5bef552d 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -73,7 +73,7 @@ int xfuse_create_share(tui32 device_id, char *dirname) { r
void xfuse_devredir_cb_open_file(void *vp, tui32 IoStatus, tui32 DeviceId, tui32 FileId) {}
void xfuse_devredir_cb_write_file(void *vp, char *buf, size_t length) {}
void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length) {}
-void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode) {}
+int xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode) {}
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus) {}
void xfuse_devredir_cb_rmdir_or_file(void *vp, tui32 IoStatus) {}
void xfuse_devredir_cb_rename_file(void *vp, tui32 IoStatus) {}
@@ -1422,7 +1422,7 @@ static void xfuse_update_xrdpfs_size()
* Add a file or directory to xrdp file system
*****************************************************************************/
-void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
+int xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
{
XFUSE_INFO *fip = (XFUSE_INFO *) vp;
XRDP_INODE *xip = NULL;
@@ -1430,13 +1430,14 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
if ((fip == NULL) || (xinode == NULL))
{
log_error("fip or xinode are NULL");
- return;
+ return -1;
}
if (!xfuse_is_inode_valid(fip->inode))
{
log_error("inode %d is not valid", fip->inode);
- return;
+ g_free(xinode);
+ return -1;
}
log_debug("parent_inode=%d name=%s", fip->inode, xinode->name);
@@ -1444,8 +1445,8 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
/* if filename is . or .. don't add it */
if ((strcmp(xinode->name, ".") == 0) || (strcmp(xinode->name, "..") == 0))
{
- free(xinode);
- return;
+ g_free(xinode);
+ return -1;
}
xfuse_dump_fs();
@@ -1454,9 +1455,9 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
{
log_debug("inode=%d name=%s already exists in xrdp_fs; not adding it",
fip->inode, xinode->name);
- free(xinode);
+ g_free(xinode);
xip->stale = 0;
- return;
+ return -1;
}
xinode->parent_inode = fip->inode;
@@ -1473,6 +1474,7 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
xfuse_update_xrdpfs_size();
xfuse_dump_fs();
+ return 0;
}
/**
diff --git a/sesman/chansrv/chansrv_fuse.h b/sesman/chansrv/chansrv_fuse.h
index 09011452..41a73062 100644
--- a/sesman/chansrv/chansrv_fuse.h
+++ b/sesman/chansrv/chansrv_fuse.h
@@ -57,7 +57,7 @@ int xfuse_file_contents_size(int stream_id, int file_size);
int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex);
/* functions that are invoked from devredir */
-void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode);
+int xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode);
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus);
void xfuse_devredir_cb_open_file(void *vp, tui32 IoStatus, tui32 DeviceId, tui32 FileId);
void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length);
diff --git a/sesman/chansrv/devredir.c b/sesman/chansrv/devredir.c
index cdcc9e94..9b746a98 100644
--- a/sesman/chansrv/devredir.c
+++ b/sesman/chansrv/devredir.c
@@ -879,7 +879,7 @@ dev_redir_proc_query_dir_response(IRP *irp,
tui32 IoStatus)
{
FUSE_DATA *fuse_data = NULL;
- XRDP_INODE *xinode = NULL;
+ XRDP_INODE *xinode;
tui32 Length;
tui32 NextEntryOffset;
@@ -1017,6 +1017,7 @@ dev_redir_get_dir_listing(void *fusep, tui32 device_id, char *path)
irp->CompletionId = g_completion_id++;
irp->completion_type = CID_CREATE_DIR_REQ;
irp->DeviceId = device_id;
+
strcpy(irp->pathname, path);
devredir_fuse_data_enqueue(irp, fusep);
@@ -1069,6 +1070,7 @@ dev_redir_file_open(void *fusep, tui32 device_id, char *path,
irp->CompletionId = g_completion_id++;
irp->DeviceId = device_id;
+
strcpy(irp->pathname, path);
devredir_fuse_data_enqueue(irp, fusep);
@@ -1174,6 +1176,7 @@ devredir_rmdir_or_file(void *fusep, tui32 device_id, char *path, int mode)
irp->CompletionId = g_completion_id++;
irp->completion_type = CID_RMDIR_OR_FILE;
irp->DeviceId = device_id;
+
strcpy(irp->pathname, path);
devredir_fuse_data_enqueue(irp, fusep);
@@ -1216,6 +1219,7 @@ devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
{
log_error("no IRP found with FileId = %d", FileId);
xfuse_devredir_cb_read_file(fusep, NULL, 0);
+ xstream_free(s);
return -1;
}
@@ -1224,6 +1228,7 @@ devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
{
/* system out of memory */
xfuse_devredir_cb_read_file(fusep, NULL, 0);
+ xstream_free(s);
return -1;
}
new_irp->FileId = 0;
@@ -1268,6 +1273,7 @@ dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
{
log_error("no IRP found with FileId = %d", FileId);
xfuse_devredir_cb_write_file(fusep, NULL, 0);
+ xstream_free(s);
return -1;
}
@@ -1276,6 +1282,7 @@ dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
{
/* system out of memory */
xfuse_devredir_cb_write_file(fusep, NULL, 0);
+ xstream_free(s);
return -1;
}
new_irp->FileId = 0;
diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c
index 4888d2e0..4d620c00 100644
--- a/sesman/chansrv/rail.c
+++ b/sesman/chansrv/rail.c
@@ -1254,6 +1254,7 @@ rail_win_send_text(Window win)
else
{
LOG(0, ("chansrv::rail_win_send_text: error rail_get_window_data_safe failed"));
+ g_free(data);
return 1;
}
if (data && len > 0)
diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c
index 0d6d5405..a07e36eb 100644
--- a/sesman/chansrv/smartcard.c
+++ b/sesman/chansrv/smartcard.c
@@ -861,11 +861,6 @@ scard_make_new_ioctl(IRP *irp, tui32 ioctl)
struct stream *s;
xstream_new(s, 1024 * 4);
- if (s == NULL)
- {
- log_error("system out of memory");
- return s;
- }
devredir_insert_DeviceIoRequest(s,
irp->DeviceId,
diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c
index 1d1618dc..9824432e 100644
--- a/sesman/chansrv/smartcard_pcsc.c
+++ b/sesman/chansrv/smartcard_pcsc.c
@@ -603,6 +603,7 @@ scard_process_list_readers(struct trans *con, struct stream *in_s)
{
LLOGLN(0, ("scard_process_list_readers: "
"get_pcsc_context_by_app_context failed"));
+ g_free(groups);
return 1;
}
pcscListReaders = g_malloc(sizeof(struct pcsc_list_readers), 1);
@@ -1489,6 +1490,7 @@ scard_process_get_status_change(struct trans *con, struct stream *in_s)
{
LLOGLN(0, ("scard_process_get_status_change: "
"get_pcsc_context_by_app_context failed"));
+ g_free(rsa);
return 1;
}
scard_send_get_status_change(user_data,
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c
index cc64a558..a90bf905 100644
--- a/sesman/chansrv/sound.c
+++ b/sesman/chansrv/sound.c
@@ -1189,7 +1189,6 @@ sound_sndsrvr_source_data_in(struct trans *trans)
s_mark_end(s);
trans_force_write_s(trans, s);
- xstream_free(s);
}
else if (cmd == PA_CMD_START_REC)
{
@@ -1200,5 +1199,7 @@ sound_sndsrvr_source_data_in(struct trans *trans)
sound_input_stop_recording();
}
+ xstream_free(s);
+
return 0;
}
diff --git a/sesman/libscp/libscp_v1c.c b/sesman/libscp/libscp_v1c.c
index 7d1b9db8..848b3437 100644
--- a/sesman/libscp/libscp_v1c.c
+++ b/sesman/libscp/libscp_v1c.c
@@ -215,6 +215,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != 42)
{
+ g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}
diff --git a/sesman/libscp/libscp_v1c_mng.c b/sesman/libscp/libscp_v1c_mng.c
index 59762e36..dc1016db 100644
--- a/sesman/libscp/libscp_v1c_mng.c
+++ b/sesman/libscp/libscp_v1c_mng.c
@@ -164,6 +164,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
+ g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@@ -180,6 +181,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_CMD_MNG_LIST) /* session list */
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
+ g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}
diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c
index 12115929..2324b750 100644
--- a/sesman/scp_v1.c
+++ b/sesman/scp_v1.c
@@ -195,8 +195,6 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
parseCommonStates(e, "scp_v1s_list_sessions()");
break;
}
-
- g_free(slist);
}
/* resource management */
@@ -208,6 +206,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
/* cleanup */
scp_session_destroy(s);
auth_end(data);
+ g_free(slist);
}
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f)
diff --git a/sesman/session.c b/sesman/session.c
index 091ce013..130ca26c 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -759,8 +759,12 @@ session_start_fork(int width, int height, int bpp, char *username,
/*THREAD-FIX release chain lock */
lock_chain_release();
+
+ return display;
}
+ g_free(temp->item);
+ g_free(temp);
return display;
}
@@ -1003,6 +1007,7 @@ session_get_bypid(int pid)
"pid %d is null!", pid);
/*THREAD-FIX release chain lock */
lock_chain_release();
+ g_free(dummy);
return 0;
}
@@ -1021,6 +1026,7 @@ session_get_bypid(int pid)
/*THREAD-FIX release chain lock */
lock_chain_release();
+ g_free(dummy);
return 0;
}
diff --git a/sesman/sig.c b/sesman/sig.c
index 7bb881ce..72892fb2 100644
--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -86,6 +86,7 @@ sig_sesman_reload_cfg(int sig)
if (config_read(cfg) != 0)
{
log_message(LOG_LEVEL_ERROR, "error reading config - keeping old cfg");
+ g_free(cfg);
return;
}
diff --git a/sesman/tools/sesadmin.c b/sesman/tools/sesadmin.c
index 25af850b..979a22f9 100644
--- a/sesman/tools/sesadmin.c
+++ b/sesman/tools/sesadmin.c
@@ -179,16 +179,16 @@ void cmndList(struct SCP_CONNECTION *c)
(dsl[idx]).idle_days, (dsl[idx]).idle_hours, (dsl[idx]).idle_minutes, \
(dsl[idx]).conn_year, (dsl[idx]).conn_month, (dsl[idx]).conn_day, (dsl[idx]).conn_hour, (dsl[idx]).conn_minute);
}
-
- if (0 != dsl)
- {
- g_free(dsl);
- }
}
else
{
printf("No sessions.\n");
}
+
+ if (0 != dsl)
+ {
+ g_free(dsl);
+ }
}
void cmndKill(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
diff --git a/xrdp/lang.c b/xrdp/lang.c
index 2f2a3da5..5ffff0eb 100644
--- a/xrdp/lang.c
+++ b/xrdp/lang.c
@@ -231,7 +231,7 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap)
{
fd = g_file_open(filename);
- if (fd > 0)
+ if (fd != -1)
{
lkeymap = (struct xrdp_keymap *)g_malloc(sizeof(struct xrdp_keymap), 0);
/* make a copy of the build in kaymap */
diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c
index 2a706b91..7f6ab281 100644
--- a/xrdp/xrdp_listen.c
+++ b/xrdp/xrdp_listen.c
@@ -169,7 +169,7 @@ xrdp_listen_get_port_address(char *port, int port_bytes,
*tcp_nodelay = 0 ;
*tcp_keepalive = 0 ;
- if (fd > 0)
+ if (fd != -1)
{
names = list_create();
names->auto_free = 1;
@@ -242,9 +242,10 @@ xrdp_listen_get_port_address(char *port, int port_bytes,
list_delete(names);
list_delete(values);
- g_file_close(fd);
}
+ g_file_close(fd);
+
/* startup_param overrides */
if (startup_param->port[0] != 0)
{
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index 1054ba2e..80383f2f 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -1287,9 +1287,9 @@ xrdp_mm_get_sesman_port(char *port, int port_bytes)
list_delete(names);
list_delete(values);
- g_file_close(fd);
}
+ g_file_close(fd);
return 0;
}
@@ -1414,7 +1414,7 @@ access_control(char *username, char *password, char *srv)
int index;
int socket = g_tcp_socket();
- if (socket > 0)
+ if (socket != -1)
{
/* we use a blocking socket here */
reply = g_tcp_connect(socket, srv, "3350");
@@ -1507,6 +1507,9 @@ access_control(char *username, char *password, char *srv)
log_message(LOG_LEVEL_ERROR, "Failure creating socket - for access control");
}
+ if (socket != -1)
+ g_tcp_close(socket);
+
return rec;
}
#endif
@@ -2719,10 +2722,11 @@ int read_allowed_channel_names(struct list *names, struct list *values)
int ret = 0;
char cfg_file[256];
int pos;
+
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file);
- if (fd > 0)
+ if (fd != -1)
{
names->auto_free = 1;
values->auto_free = 1;
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index caf55a7d..8f1016bd 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -236,10 +236,11 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data,
init_stream(fs, 8192);
fd = g_file_open(file_name);
- if (fd < 1)
+ if (fd < 0)
{
log_message(LOG_LEVEL_ERROR,"xrdp_wm_load_pointer: error loading pointer from file [%s]",
file_name);
+ xstream_free(fs);
return 1;
}
@@ -567,7 +568,7 @@ xrdp_wm_init(struct xrdp_wm *self)
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file); /* xrdp.ini */
- if (fd > 0)
+ if (fd != -1)
{
names = list_create();
names->auto_free = 1;