Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
00f0bdcb
Commit
00f0bdcb
authored
Apr 27, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd_FileNew: avoid strdup() with unhandled error
parent
5fee0e7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
src/network/httpd.c
src/network/httpd.c
+10
-16
No files found.
src/network/httpd.c
View file @
00f0bdcb
...
...
@@ -300,12 +300,9 @@ static size_t httpd_HtmlError (char **body, int code, const char *url)
struct
httpd_file_t
{
httpd_url_t
*
url
;
char
*
psz_mime
;
httpd_file_callback_t
pf_fill
;
httpd_file_sys_t
*
p_sys
;
char
mime
[
1
];
};
static
int
...
...
@@ -325,7 +322,7 @@ httpd_FileCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
answer
->
i_status
=
200
;
httpd_MsgAdd
(
answer
,
"Content-type"
,
"%s"
,
file
->
psz_
mime
);
httpd_MsgAdd
(
answer
,
"Content-type"
,
"%s"
,
file
->
mime
);
httpd_MsgAdd
(
answer
,
"Cache-Control"
,
"%s"
,
"no-cache"
);
if
(
query
->
i_type
!=
HTTPD_MSG_HEAD
)
{
...
...
@@ -365,8 +362,13 @@ httpd_file_t *httpd_FileNew(httpd_host_t *host,
httpd_file_callback_t
pf_fill
,
httpd_file_sys_t
*
p_sys
)
{
httpd_file_t
*
file
=
malloc
(
sizeof
(
*
file
));
if
(
!
file
)
const
char
*
mime
=
psz_mime
;
if
(
mime
==
NULL
||
mime
[
0
]
==
'\0'
)
mime
=
vlc_mime_Ext2Mime
(
psz_url
);
size_t
mimelen
=
strlen
(
mime
);
httpd_file_t
*
file
=
malloc
(
sizeof
(
*
file
)
+
mimelen
);
if
(
unlikely
(
file
==
NULL
))
return
NULL
;
file
->
url
=
httpd_UrlNew
(
host
,
psz_url
,
psz_user
,
psz_password
);
...
...
@@ -375,13 +377,9 @@ httpd_file_t *httpd_FileNew(httpd_host_t *host,
return
NULL
;
}
if
(
psz_mime
&&
*
psz_mime
)
file
->
psz_mime
=
strdup
(
psz_mime
);
else
file
->
psz_mime
=
strdup
(
vlc_mime_Ext2Mime
(
psz_url
));
file
->
pf_fill
=
pf_fill
;
file
->
p_sys
=
p_sys
;
memcpy
(
file
->
mime
,
mime
,
mimelen
+
1
);
httpd_UrlCatch
(
file
->
url
,
HTTPD_MSG_HEAD
,
httpd_FileCallBack
,
(
httpd_callback_sys_t
*
)
file
);
...
...
@@ -398,11 +396,7 @@ httpd_file_sys_t *httpd_FileDelete(httpd_file_t *file)
httpd_file_sys_t
*
p_sys
=
file
->
p_sys
;
httpd_UrlDelete
(
file
->
url
);
free
(
file
->
psz_mime
);
free
(
file
);
return
p_sys
;
}
...
...
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