summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
Diffstat (limited to 'sesman')
-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
13 files changed, 40 insertions, 23 deletions
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)