Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
2b9e7ac1
Commit
2b9e7ac1
authored
Aug 21, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ftp: fix memory leak and avoid forward declaration
parent
9cd91f92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
modules/access/ftp.c
modules/access/ftp.c
+31
-26
No files found.
modules/access/ftp.c
View file @
2b9e7ac1
...
...
@@ -113,7 +113,37 @@ struct access_sys_t
#define GET_OUT_SYS( p_this ) \
((access_sys_t *)(((sout_access_out_t *)(p_this))->p_sys))
static
int
ftp_SendCommand
(
vlc_object_t
*
,
access_sys_t
*
,
const
char
*
,
...
);
static
int
ftp_SendCommand
(
vlc_object_t
*
obj
,
access_sys_t
*
sys
,
const
char
*
fmt
,
...
)
{
size_t
fmtlen
=
strlen
(
fmt
);
char
fmtbuf
[
fmtlen
+
3
];
memcpy
(
fmtbuf
,
fmt
,
fmtlen
);
memcpy
(
fmtbuf
+
fmtlen
,
"
\r\n
"
,
3
);
va_list
args
;
char
*
cmd
;
int
val
;
va_start
(
args
,
fmt
);
val
=
vasprintf
(
&
cmd
,
fmtbuf
,
args
);
va_end
(
args
);
if
(
unlikely
(
val
==
-
1
)
)
return
-
1
;
msg_Dbg
(
obj
,
"sending request:
\"
%.*s
\"
(%d bytes)"
,
val
-
2
,
cmd
,
val
);
if
(
net_Write
(
obj
,
sys
->
fd_cmd
,
NULL
,
cmd
,
val
)
!=
val
)
{
msg_Err
(
obj
,
"request failure"
);
val
=
-
1
;
}
else
val
=
0
;
free
(
cmd
);
return
val
;
}
static
int
ftp_ReadCommand
(
vlc_object_t
*
,
access_sys_t
*
,
int
*
,
char
**
);
static
int
ftp_StartStream
(
vlc_object_t
*
,
access_sys_t
*
,
uint64_t
);
static
int
ftp_StopStream
(
vlc_object_t
*
,
access_sys_t
*
);
...
...
@@ -619,31 +649,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
return
VLC_SUCCESS
;
}
/*****************************************************************************
* ftp_*:
*****************************************************************************/
static
int
ftp_SendCommand
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
,
const
char
*
psz_fmt
,
...
)
{
va_list
args
;
char
*
psz_cmd
;
va_start
(
args
,
psz_fmt
);
if
(
vasprintf
(
&
psz_cmd
,
psz_fmt
,
args
)
==
-
1
)
return
VLC_EGENERIC
;
va_end
(
args
);
msg_Dbg
(
p_access
,
"ftp_SendCommand:
\"
%s
\"
"
,
psz_cmd
);
if
(
net_Printf
(
p_access
,
p_sys
->
fd_cmd
,
NULL
,
"%s
\r\n
"
,
psz_cmd
)
<
0
)
{
msg_Err
(
p_access
,
"failed to send command"
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
/* TODO support this s**t :
RFC 959 allows the client to send certain TELNET strings at any moment,
even in the middle of a request:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment