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
df18db13
Commit
df18db13
authored
Oct 01, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning and fix potential memleaks.
parent
d7fb424d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
modules/codec/cmml/xurl.c
modules/codec/cmml/xurl.c
+15
-20
No files found.
modules/codec/cmml/xurl.c
View file @
df18db13
...
@@ -51,8 +51,6 @@ char *XURL_Join( char *psz_url1, char *psz_url2 )
...
@@ -51,8 +51,6 @@ char *XURL_Join( char *psz_url1, char *psz_url2 )
return
XURL_Concat
(
psz_url1
,
psz_url2
);
return
XURL_Concat
(
psz_url1
,
psz_url2
);
else
else
return
XURL_Concat
(
psz_url2
,
psz_url1
);
return
XURL_Concat
(
psz_url2
,
psz_url1
);
return
NULL
;
}
}
/* TODO: replace XURL_Concat's rel/absolute calculation with the one
/* TODO: replace XURL_Concat's rel/absolute calculation with the one
...
@@ -223,24 +221,20 @@ char *XURL_GetHostname( char *psz_url )
...
@@ -223,24 +221,20 @@ char *XURL_GetHostname( char *psz_url )
char
*
XURL_GetSchemeAndHostname
(
char
*
psz_url
)
char
*
XURL_GetSchemeAndHostname
(
char
*
psz_url
)
{
{
char
*
psz_scheme
,
*
psz_hostname
,
*
psz_scheme_and_hostname
;
char
*
psz_scheme
=
NULL
,
*
psz_hostname
=
NULL
,
*
psz_scheme_and_hostname
=
NULL
;
psz_scheme
=
XURL_GetScheme
(
psz_url
);
psz_scheme
=
XURL_GetScheme
(
psz_url
);
if
(
psz_scheme
==
NULL
)
return
NULL
;
psz_hostname
=
XURL_GetHostname
(
psz_url
);
psz_hostname
=
XURL_GetHostname
(
psz_url
);
if
(
psz_hostname
==
NULL
)
return
NULL
;
if
(
psz_hostname
&&
psz_scheme
)
{
/* malloc +1 for the terminating '\0' */
if
(
asprintf
(
&
psz_scheme_and_hostname
,
"%s://%s"
,
psz_scheme
,
psz_hostname
)
==
-
1
)
psz_scheme_and_hostname
=
malloc
(
psz_scheme_and_hostname
=
NULL
;
strlen
(
psz_scheme
)
+
strlen
(
"://"
)
+
}
strlen
(
psz_hostname
)
+
1
);
if
(
psz_scheme_and_hostname
==
NULL
)
return
NULL
;
free
(
psz_hostname
);
strcpy
(
psz_scheme_and_hostname
,
psz_scheme
);
free
(
psz_scheme
);
strcat
(
psz_scheme_and_hostname
,
"://"
);
strcat
(
psz_scheme_and_hostname
,
psz_hostname
);
if
(
psz_scheme_and_hostname
==
NULL
)
return
NULL
;
return
psz_scheme_and_hostname
;
return
psz_scheme_and_hostname
;
}
}
...
@@ -280,7 +274,8 @@ char *XURL_GetScheme( char *psz_url )
...
@@ -280,7 +274,8 @@ char *XURL_GetScheme( char *psz_url )
size_t
i_scheme_length
;
size_t
i_scheme_length
;
char
*
new_scheme
;
char
*
new_scheme
;
if
(
XURL_IsAbsolute
(
psz_url
)
==
XURL_FALSE
)
return
strdup
(
"file"
);
if
(
XURL_IsAbsolute
(
psz_url
)
==
XURL_FALSE
)
return
strdup
(
"file"
);
/* this strchr will always succeed since we have an absolute URL, and thus
/* this strchr will always succeed since we have an absolute URL, and thus
* a scheme */
* a scheme */
...
@@ -289,10 +284,10 @@ char *XURL_GetScheme( char *psz_url )
...
@@ -289,10 +284,10 @@ char *XURL_GetScheme( char *psz_url )
i_scheme_length
=
psz_colon
-
psz_url
;
i_scheme_length
=
psz_colon
-
psz_url
;
new_scheme
=
malloc
(
i_scheme_length
);
new_scheme
=
malloc
(
i_scheme_length
);
if
(
new_scheme
==
NULL
)
return
NULL
;
if
(
new_scheme
==
NULL
)
return
NULL
;
strncpy
(
new_scheme
,
psz_url
,
i_scheme_length
);
strncpy
(
new_scheme
,
psz_url
,
i_scheme_length
);
return
new_scheme
;
return
new_scheme
;
}
}
...
...
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