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
48e4674a
Commit
48e4674a
authored
Dec 06, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not assert memory allocations
parent
25232e20
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
17 additions
and
47 deletions
+17
-47
src/control/media_list_path.h
src/control/media_list_path.h
+5
-13
src/extras/libc.c
src/extras/libc.c
+1
-3
src/input/es_out.c
src/input/es_out.c
+2
-7
src/input/input.c
src/input/input.c
+1
-3
src/input/vlmshell.c
src/input/vlmshell.c
+1
-3
src/misc/messages.c
src/misc/messages.c
+2
-5
src/misc/objects.c
src/misc/objects.c
+0
-1
src/misc/variables.c
src/misc/variables.c
+1
-3
src/network/httpd.c
src/network/httpd.c
+1
-2
src/network/io.c
src/network/io.c
+1
-3
src/text/strings.c
src/text/strings.c
+2
-4
No files found.
src/control/media_list_path.h
View file @
48e4674a
...
...
@@ -25,9 +25,6 @@
#ifndef _LIBVLC_MEDIA_LIST_PATH_H
#define _LIBVLC_MEDIA_LIST_PATH_H 1
#include <assert.h>
#include <vlc_memory.h>
typedef
int
*
libvlc_media_list_path_t
;
/* (Media List Player Internal) */
/**************************************************************************
...
...
@@ -52,8 +49,7 @@ static inline void libvlc_media_list_path_dump( const libvlc_media_list_path_t p
**************************************************************************/
static
inline
libvlc_media_list_path_t
libvlc_media_list_path_empty
(
void
)
{
libvlc_media_list_path_t
ret
=
malloc
(
sizeof
(
int
));
assert
(
ret
);
libvlc_media_list_path_t
ret
=
xmalloc
(
sizeof
(
int
));
ret
[
0
]
=
-
1
;
return
ret
;
}
...
...
@@ -63,8 +59,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_empty( void )
**************************************************************************/
static
inline
libvlc_media_list_path_t
libvlc_media_list_path_with_root_index
(
int
index
)
{
libvlc_media_list_path_t
ret
=
malloc
(
sizeof
(
int
)
*
2
);
assert
(
ret
);
libvlc_media_list_path_t
ret
=
xmalloc
(
sizeof
(
int
)
*
2
);
ret
[
0
]
=
index
;
ret
[
1
]
=
-
1
;
return
ret
;
...
...
@@ -86,8 +81,7 @@ static inline int libvlc_media_list_path_depth( const libvlc_media_list_path_t p
static
inline
void
libvlc_media_list_path_append
(
libvlc_media_list_path_t
*
p_path
,
int
index
)
{
int
old_depth
=
libvlc_media_list_path_depth
(
*
p_path
);
*
p_path
=
realloc_or_free
(
*
p_path
,
sizeof
(
int
)
*
(
old_depth
+
2
));
assert
(
*
p_path
);
*
p_path
=
xrealloc
(
*
p_path
,
sizeof
(
int
)
*
(
old_depth
+
2
));
*
p_path
[
old_depth
]
=
index
;
*
p_path
[
old_depth
+
1
]
=
-
1
;
}
...
...
@@ -99,8 +93,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending(
{
libvlc_media_list_path_t
ret
;
int
old_depth
=
libvlc_media_list_path_depth
(
path
);
ret
=
malloc
(
sizeof
(
int
)
*
(
old_depth
+
2
)
);
assert
(
ret
);
ret
=
xmalloc
(
sizeof
(
int
)
*
(
old_depth
+
2
)
);
memcpy
(
ret
,
path
,
sizeof
(
int
)
*
old_depth
);
ret
[
old_depth
]
=
index
;
ret
[
old_depth
+
1
]
=
-
1
;
...
...
@@ -114,8 +107,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy( const libvlc
{
libvlc_media_list_path_t
ret
;
int
depth
=
libvlc_media_list_path_depth
(
path
);
ret
=
malloc
(
sizeof
(
int
)
*
(
depth
+
1
)
);
assert
(
ret
);
ret
=
xmalloc
(
sizeof
(
int
)
*
(
depth
+
1
)
);
memcpy
(
ret
,
path
,
sizeof
(
int
)
*
(
depth
+
1
)
);
return
ret
;
}
...
...
src/extras/libc.c
View file @
48e4674a
...
...
@@ -30,7 +30,6 @@
#endif
#include <vlc_common.h>
#include <vlc_memory.h>
#include <ctype.h>
...
...
@@ -866,8 +865,7 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
||
i_read
==
0
)
break
;
*
pi_data
+=
i_read
;
*
pp_data
=
realloc_or_free
(
*
pp_data
,
*
pi_data
+
1025
);
assert
(
*
pp_data
);
*
pp_data
=
xrealloc
(
*
pp_data
,
*
pi_data
+
1025
);
}
while
(
!
p_object
->
b_die
...
...
src/input/es_out.c
View file @
48e4674a
...
...
@@ -39,8 +39,6 @@
#include <vlc_aout.h>
#include <vlc_fourcc.h>
#include <vlc_memory.h>
#include "input_internal.h"
#include "clock.h"
#include "decoder.h"
...
...
@@ -2348,9 +2346,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
if
(
p_fmt
->
i_extra
)
{
es
->
fmt
.
i_extra
=
p_fmt
->
i_extra
;
es
->
fmt
.
p_extra
=
realloc_or_free
(
es
->
fmt
.
p_extra
,
p_fmt
->
i_extra
);
assert
(
es
->
fmt
.
p_extra
);
es
->
fmt
.
p_extra
=
xrealloc
(
es
->
fmt
.
p_extra
,
p_fmt
->
i_extra
);
memcpy
(
es
->
fmt
.
p_extra
,
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
if
(
!
es
->
p_dec
)
...
...
@@ -2362,8 +2358,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
#else
es
->
p_dec
->
fmt_in
.
i_extra
=
p_fmt
->
i_extra
;
es
->
p_dec
->
fmt_in
.
p_extra
=
realloc_or_free
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
i_extra
);
assert
(
es
->
p_dec
->
fmt_in
.
p_extra
);
xrealloc
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
i_extra
);
memcpy
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
#endif
...
...
src/input/input.c
View file @
48e4674a
...
...
@@ -30,7 +30,6 @@
#endif
#include <vlc_common.h>
#include <vlc_memory.h>
#include <ctype.h>
#include <limits.h>
...
...
@@ -2926,9 +2925,8 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
input_attachment_t
**
attachment
=
*
ppp_attachment
;
int
i
;
attachment
=
realloc_or_free
(
attachment
,
attachment
=
xrealloc
(
attachment
,
sizeof
(
input_attachment_t
**
)
*
(
i_attachment
+
i_new
)
);
assert
(
attachment
);
for
(
i
=
0
;
i
<
i_new
;
i
++
)
attachment
[
i_attachment
++
]
=
pp_new
[
i
];
free
(
pp_new
);
...
...
src/input/vlmshell.c
View file @
48e4674a
...
...
@@ -31,7 +31,6 @@
#endif
#include <vlc_common.h>
#include <vlc_memory.h>
#include <stdio.h>
#include <ctype.h>
/* tolower() */
...
...
@@ -641,9 +640,8 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
psz_line
=
strdup
(
ppsz_property
[
i
]
);
for
(
j
=
i
+
1
;
j
<
i_property
;
j
++
)
{
psz_line
=
realloc_or_free
(
psz_line
,
psz_line
=
xrealloc
(
psz_line
,
strlen
(
psz_line
)
+
strlen
(
ppsz_property
[
j
])
+
1
+
1
);
assert
(
psz_line
);
strcat
(
psz_line
,
" "
);
strcat
(
psz_line
,
ppsz_property
[
j
]
);
}
...
...
src/misc/messages.c
View file @
48e4674a
...
...
@@ -33,7 +33,6 @@
#endif
#include <vlc_common.h>
#include <vlc_memory.h>
#include <stdarg.h>
/* va_list for BSD */
...
...
@@ -401,15 +400,13 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
if
(
psz_header
)
{
psz_old
=
strdup
(
psz_header
);
psz_header
=
realloc_or_free
(
psz_header
,
i_header_size
);
assert
(
psz_header
);
psz_header
=
xrealloc
(
psz_header
,
i_header_size
);
snprintf
(
psz_header
,
i_header_size
,
"[%s] %s"
,
p_obj
->
psz_header
,
psz_old
);
}
else
{
psz_header
=
malloc
(
i_header_size
);
assert
(
psz_header
);
psz_header
=
xmalloc
(
i_header_size
);
snprintf
(
psz_header
,
i_header_size
,
"[%s]"
,
p_obj
->
psz_header
);
}
...
...
src/misc/objects.c
View file @
48e4674a
...
...
@@ -37,7 +37,6 @@
#endif
#include <vlc_common.h>
#include <vlc_memory.h>
#include "../libvlc.h"
#include <vlc_aout.h>
...
...
src/misc/variables.c
View file @
48e4674a
...
...
@@ -30,7 +30,6 @@
#include <vlc_common.h>
#include <vlc_charset.h>
#include <vlc_memory.h>
#include "variables.h"
#include "libvlc.h"
...
...
@@ -218,9 +217,8 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
if
(
(
p_priv
->
i_vars
&
15
)
==
15
)
{
p_priv
->
p_vars
=
realloc_or_free
(
p_priv
->
p_vars
,
p_priv
->
p_vars
=
xrealloc
(
p_priv
->
p_vars
,
(
p_priv
->
i_vars
+
17
)
*
sizeof
(
variable_t
)
);
assert
(
p_priv
->
p_vars
);
}
memmove
(
p_priv
->
p_vars
+
i_new
+
1
,
...
...
src/network/httpd.c
View file @
48e4674a
...
...
@@ -563,8 +563,7 @@ httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
{
p
[
4
]
=
'\0'
;
answer
->
i_body
=
strlen
((
char
*
)
answer
->
p_body
)
+
1
;
uint8_t
*
p_body
=
realloc
(
answer
->
p_body
,
answer
->
i_body
);
if
(
p_body
)
answer
->
p_body
=
p_body
;
answer
->
p_body
=
xrealloc
(
answer
->
p_body
,
answer
->
i_body
);
}
}
...
...
src/network/io.c
View file @
48e4674a
...
...
@@ -55,7 +55,6 @@
#endif
#include <vlc_network.h>
#include <vlc_memory.h>
#ifndef INADDR_ANY
# define INADDR_ANY 0x00000000
...
...
@@ -523,8 +522,7 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
if
(
i_line
==
i_max
)
{
i_max
+=
1024
;
psz_line
=
realloc_or_free
(
psz_line
,
i_max
);
assert
(
psz_line
);
psz_line
=
xrealloc
(
psz_line
,
i_max
);
ptr
=
psz_line
+
i_line
;
}
...
...
src/text/strings.c
View file @
48e4674a
...
...
@@ -606,8 +606,7 @@ char *str_format_time( const char *tformat )
if( string != NULL ) \
{ \
int len = strlen( string ); \
dst = realloc( dst, i_size = i_size + len );\
assert( dst ); \
dst = xrealloc( dst, i_size = i_size + len );\
memcpy( (dst+d), string, len ); \
d += len; \
free( string ); \
...
...
@@ -622,8 +621,7 @@ char *str_format_time( const char *tformat )
#define INSERT_STRING_NO_FREE( string ) \
{ \
int len = strlen( string ); \
dst = realloc( dst, i_size = i_size + len );\
assert( dst ); \
dst = xrealloc( dst, i_size = i_size + len );\
memcpy( dst+d, string, len ); \
d += len; \
}
...
...
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