Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
ec5d8611
Commit
ec5d8611
authored
May 24, 2009
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct realloc() usage, on failure realloc will return NULL
parent
ac72368d
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
104 additions
and
46 deletions
+104
-46
src/control/media_list_path.h
src/control/media_list_path.h
+8
-3
src/extras/libc.c
src/extras/libc.c
+3
-1
src/input/es_out.c
src/input/es_out.c
+16
-9
src/input/input.c
src/input/input.c
+12
-8
src/input/stream.c
src/input/stream.c
+16
-8
src/input/vlmshell.c
src/input/vlmshell.c
+5
-1
src/modules/entry.c
src/modules/entry.c
+1
-1
src/modules/modules.c
src/modules/modules.c
+5
-2
src/network/acl.c
src/network/acl.c
+2
-1
src/network/httpd.c
src/network/httpd.c
+7
-2
src/network/io.c
src/network/io.c
+8
-1
src/playlist/fetcher.c
src/playlist/fetcher.c
+4
-2
src/text/strings.c
src/text/strings.c
+17
-7
No files found.
src/control/media_list_path.h
View file @
ec5d8611
...
@@ -61,10 +61,15 @@ static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path
...
@@ -61,10 +61,15 @@ static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path
**************************************************************************/
**************************************************************************/
static
inline
void
libvlc_media_list_path_append
(
libvlc_media_list_path_t
*
p_path
,
int
index
)
static
inline
void
libvlc_media_list_path_append
(
libvlc_media_list_path_t
*
p_path
,
int
index
)
{
{
libvlc_media_list_path_t
*
p_tmp
;
int
old_deepness
=
libvlc_media_list_path_deepness
(
*
p_path
);
int
old_deepness
=
libvlc_media_list_path_deepness
(
*
p_path
);
*
p_path
=
realloc
(
*
p_path
,
sizeof
(
int
)
*
(
old_deepness
+
2
));
*
p_tmp
=
realloc
(
*
p_path
,
sizeof
(
int
)
*
(
old_deepness
+
2
));
if
(
*
p_tmp
)
{
*
p_tmp
=
*
p_path
;
*
p_path
[
old_deepness
]
=
index
;
*
p_path
[
old_deepness
]
=
index
;
*
p_path
[
old_deepness
+
1
]
=
-
1
;
*
p_path
[
old_deepness
+
1
]
=
-
1
;
}
}
}
/**************************************************************************
/**************************************************************************
...
...
src/extras/libc.c
View file @
ec5d8611
...
@@ -571,7 +571,9 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
...
@@ -571,7 +571,9 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
||
i_read
==
0
)
||
i_read
==
0
)
break
;
break
;
*
pi_data
+=
i_read
;
*
pi_data
+=
i_read
;
*
pp_data
=
realloc
(
*
pp_data
,
*
pi_data
+
1025
);
char
*
p_tmp
=
realloc
(
*
pp_data
,
*
pi_data
+
1025
);
if
(
p_tmp
)
*
pp_data
=
p_tmp
;
}
}
while
(
!
p_object
->
b_die
while
(
!
p_object
->
b_die
...
...
src/input/es_out.c
View file @
ec5d8611
...
@@ -2276,11 +2276,15 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
...
@@ -2276,11 +2276,15 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
if
(
p_fmt
->
i_extra
)
if
(
p_fmt
->
i_extra
)
{
void
*
p_tmp
;
p_tmp
=
realloc
(
es
->
fmt
.
p_extra
,
p_fmt
->
i_extra
);
if
(
p_tmp
)
{
{
es
->
fmt
.
i_extra
=
p_fmt
->
i_extra
;
es
->
fmt
.
i_extra
=
p_fmt
->
i_extra
;
es
->
fmt
.
p_extra
=
realloc
(
es
->
fmt
.
p_extra
,
p_fmt
->
i_extra
)
;
es
->
fmt
.
p_extra
=
p_tmp
;
memcpy
(
es
->
fmt
.
p_extra
,
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
memcpy
(
es
->
fmt
.
p_extra
,
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
}
if
(
!
es
->
p_dec
)
if
(
!
es
->
p_dec
)
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
#if 1
#if 1
...
@@ -2288,11 +2292,14 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
...
@@ -2288,11 +2292,14 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
EsCreateDecoder
(
out
,
es
);
EsCreateDecoder
(
out
,
es
);
#else
#else
p_tmp
=
realloc
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
i_extra
);
if
(
p_tmp
)
{
es
->
p_dec
->
fmt_in
.
i_extra
=
p_fmt
->
i_extra
;
es
->
p_dec
->
fmt_in
.
i_extra
=
p_fmt
->
i_extra
;
es
->
p_dec
->
fmt_in
.
p_extra
=
es
->
p_dec
->
fmt_in
.
p_extra
=
p_tmp
;
realloc
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
i_extra
);
memcpy
(
es
->
p_dec
->
fmt_in
.
p_extra
,
memcpy
(
es
->
p_dec
->
fmt_in
.
p_extra
,
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
p_fmt
->
p_extra
,
p_fmt
->
i_extra
);
}
#endif
#endif
}
}
...
...
src/input/input.c
View file @
ec5d8611
...
@@ -2913,11 +2913,13 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
...
@@ -2913,11 +2913,13 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
int
i_new
,
input_attachment_t
**
pp_new
)
int
i_new
,
input_attachment_t
**
pp_new
)
{
{
int
i_attachment
=
*
pi_attachment
;
int
i_attachment
=
*
pi_attachment
;
input_attachment_t
**
attachment
=
*
ppp_attachment
;
input_attachment_t
**
attachment
;
int
i
;
int
i
;
attachment
=
realloc
(
attachment
,
attachment
=
realloc
(
*
ppp_
attachment
,
sizeof
(
input_attachment_t
**
)
*
(
i_attachment
+
i_new
)
);
sizeof
(
input_attachment_t
**
)
*
(
i_attachment
+
i_new
)
);
if
(
attachment
)
{
for
(
i
=
0
;
i
<
i_new
;
i
++
)
for
(
i
=
0
;
i
<
i_new
;
i
++
)
attachment
[
i_attachment
++
]
=
pp_new
[
i
];
attachment
[
i_attachment
++
]
=
pp_new
[
i
];
free
(
pp_new
);
free
(
pp_new
);
...
@@ -2925,7 +2927,9 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
...
@@ -2925,7 +2927,9 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
/* */
/* */
*
pi_attachment
=
i_attachment
;
*
pi_attachment
=
i_attachment
;
*
ppp_attachment
=
attachment
;
*
ppp_attachment
=
attachment
;
}
}
}
/*****************************************************************************
/*****************************************************************************
* InputGetExtraFiles
* InputGetExtraFiles
* Autodetect extra input list
* Autodetect extra input list
...
...
src/input/stream.c
View file @
ec5d8611
...
@@ -796,12 +796,14 @@ static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, unsigned int
...
@@ -796,12 +796,14 @@ static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, unsigned int
/* We need to create a local copy */
/* We need to create a local copy */
if
(
p_sys
->
i_peek
<
i_read
)
if
(
p_sys
->
i_peek
<
i_read
)
{
{
p_sys
->
p_peek
=
realloc
(
p_sys
->
p_peek
,
i_read
);
uint8_t
*
p_tmp
;
if
(
!
p_sys
->
p_peek
)
p_tmp
=
realloc
(
p_sys
->
p_peek
,
i_read
);
if
(
!
p_tmp
)
{
{
p_sys
->
i_peek
=
0
;
p_sys
->
i_peek
=
0
;
return
0
;
return
0
;
}
}
p_sys
->
p_peek
=
p_tmp
;
p_sys
->
i_peek
=
i_read
;
p_sys
->
i_peek
=
i_read
;
}
}
...
@@ -1170,13 +1172,15 @@ static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int
...
@@ -1170,13 +1172,15 @@ static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int
if
(
p_sys
->
i_peek
<
i_read
)
if
(
p_sys
->
i_peek
<
i_read
)
{
{
p_sys
->
p_peek
=
realloc
(
p_sys
->
p_peek
,
i_read
);
uint8_t
*
p_tmp
;
if
(
!
p_sys
->
p_peek
)
p_tmp
=
realloc
(
p_sys
->
p_peek
,
i_read
);
if
(
!
p_tmp
)
{
{
p_sys
->
i_peek
=
0
;
p_sys
->
i_peek
=
0
;
return
0
;
return
0
;
}
}
p_sys
->
i_peek
=
i_read
;
p_sys
->
i_peek
=
i_read
;
p_sys
->
p_peek
=
p_tmp
;
}
}
memcpy
(
p_sys
->
p_peek
,
&
tk
->
p_buffer
[
i_off
],
memcpy
(
p_sys
->
p_peek
,
&
tk
->
p_buffer
[
i_off
],
...
@@ -1587,10 +1591,12 @@ char *stream_ReadLine( stream_t *s )
...
@@ -1587,10 +1591,12 @@ char *stream_ReadLine( stream_t *s )
if
(
psz_eol
)
if
(
psz_eol
)
{
{
char
*
p_tmp
;
i_data
=
(
psz_eol
-
(
char
*
)
p_data
)
+
1
;
i_data
=
(
psz_eol
-
(
char
*
)
p_data
)
+
1
;
p_
line
=
realloc
(
p_line
,
i_line
+
i_data
+
s
->
p_text
->
i_char_width
);
/* add \0 */
p_
tmp
=
realloc
(
p_line
,
i_line
+
i_data
+
s
->
p_text
->
i_char_width
);
/* add \0 */
if
(
!
p_
line
)
if
(
!
p_
tmp
)
goto
error
;
goto
error
;
p_line
=
p_tmp
;
i_data
=
stream_Read
(
s
,
&
p_line
[
i_line
],
i_data
);
i_data
=
stream_Read
(
s
,
&
p_line
[
i_line
],
i_data
);
if
(
i_data
<=
0
)
break
;
/* Hmmm */
if
(
i_data
<=
0
)
break
;
/* Hmmm */
i_line
+=
i_data
-
s
->
p_text
->
i_char_width
;
/* skip \n */
;
i_line
+=
i_data
-
s
->
p_text
->
i_char_width
;
/* skip \n */
;
...
@@ -1601,9 +1607,11 @@ char *stream_ReadLine( stream_t *s )
...
@@ -1601,9 +1607,11 @@ char *stream_ReadLine( stream_t *s )
}
}
/* Read data (+1 for easy \0 append) */
/* Read data (+1 for easy \0 append) */
p_line
=
realloc
(
p_line
,
i_line
+
STREAM_PROBE_LINE
+
s
->
p_text
->
i_char_width
);
char
*
p_tmp
;
if
(
!
p_line
)
p_tmp
=
realloc
(
p_line
,
i_line
+
STREAM_PROBE_LINE
+
s
->
p_text
->
i_char_width
);
if
(
!
p_tmp
)
goto
error
;
goto
error
;
p_line
=
p_tmp
;
i_data
=
stream_Read
(
s
,
&
p_line
[
i_line
],
STREAM_PROBE_LINE
);
i_data
=
stream_Read
(
s
,
&
p_line
[
i_line
],
STREAM_PROBE_LINE
);
if
(
i_data
<=
0
)
break
;
/* Hmmm */
if
(
i_data
<=
0
)
break
;
/* Hmmm */
i_line
+=
i_data
;
i_line
+=
i_data
;
...
...
src/input/vlmshell.c
View file @
ec5d8611
...
@@ -641,7 +641,11 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
...
@@ -641,7 +641,11 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
psz_line
=
strdup
(
ppsz_property
[
i
]
);
psz_line
=
strdup
(
ppsz_property
[
i
]
);
for
(
j
=
i
+
1
;
j
<
i_property
;
j
++
)
for
(
j
=
i
+
1
;
j
<
i_property
;
j
++
)
{
{
psz_line
=
realloc
(
psz_line
,
strlen
(
psz_line
)
+
strlen
(
ppsz_property
[
j
])
+
1
+
1
);
char
*
psz_tmp
;
psz_tmp
=
realloc
(
psz_line
,
strlen
(
psz_line
)
+
strlen
(
ppsz_property
[
j
])
+
1
+
1
);
if
(
!
psz_tmp
)
break
;
psz_line
=
psz_tmp
;
strcat
(
psz_line
,
" "
);
strcat
(
psz_line
,
" "
);
strcat
(
psz_line
,
ppsz_property
[
j
]
);
strcat
(
psz_line
,
ppsz_property
[
j
]
);
}
}
...
...
src/modules/entry.c
View file @
ec5d8611
...
@@ -142,7 +142,7 @@ static module_config_t *vlc_config_create (module_t *module, int type)
...
@@ -142,7 +142,7 @@ static module_config_t *vlc_config_create (module_t *module, int type)
if
((
confsize
&
0xf
)
==
0
)
if
((
confsize
&
0xf
)
==
0
)
{
{
tab
=
realloc
(
tab
,
(
confsize
+
17
)
*
sizeof
(
*
tab
));
tab
=
realloc
(
module
->
p_config
,
(
confsize
+
17
)
*
sizeof
(
*
tab
));
if
(
tab
==
NULL
)
if
(
tab
==
NULL
)
return
NULL
;
return
NULL
;
...
...
src/modules/modules.c
View file @
ec5d8611
...
@@ -1217,8 +1217,11 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
...
@@ -1217,8 +1217,11 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
return
0
;
return
0
;
/* Add entry to cache */
/* Add entry to cache */
p_bank
->
pp_cache
=
module_cache_t
*
p_tmp
;
realloc
(
p_bank
->
pp_cache
,
(
p_bank
->
i_cache
+
1
)
*
sizeof
(
void
*
)
);
p_tmp
=
realloc
(
p_bank
->
pp_cache
,
(
p_bank
->
i_cache
+
1
)
*
sizeof
(
void
*
)
);
if
(
!
p_tmp
)
return
-
1
;
*
p_bank
->
pp_cache
=
p_tmp
;
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
=
malloc
(
sizeof
(
module_cache_t
)
);
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
=
malloc
(
sizeof
(
module_cache_t
)
);
if
(
!
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
)
if
(
!
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
)
return
-
1
;
return
-
1
;
...
...
src/network/acl.c
View file @
ec5d8611
...
@@ -163,11 +163,12 @@ int ACL_AddNet( vlc_acl_t *p_acl, const char *psz_ip, int i_len,
...
@@ -163,11 +163,12 @@ int ACL_AddNet( vlc_acl_t *p_acl, const char *psz_ip, int i_len,
i_size
=
p_acl
->
i_size
;
i_size
=
p_acl
->
i_size
;
p_ent
=
(
vlc_acl_entry_t
*
)
realloc
(
p_acl
->
p_entries
,
p_ent
=
(
vlc_acl_entry_t
*
)
realloc
(
p_acl
->
p_entries
,
++
p_acl
->
i_size
*
sizeof
(
*
p_ent
)
);
(
p_acl
->
i_size
+
1
)
*
sizeof
(
*
p_ent
)
);
if
(
p_ent
==
NULL
)
if
(
p_ent
==
NULL
)
return
-
1
;
return
-
1
;
p_acl
->
i_size
++
;
p_acl
->
p_entries
=
p_ent
;
p_acl
->
p_entries
=
p_ent
;
p_ent
+=
i_size
;
p_ent
+=
i_size
;
...
...
src/network/httpd.c
View file @
ec5d8611
...
@@ -561,9 +561,14 @@ httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
...
@@ -561,9 +561,14 @@ httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
if
(
p
!=
NULL
)
if
(
p
!=
NULL
)
{
{
httpd_message_t
*
p_msg
;
p
[
4
]
=
'\0'
;
p
[
4
]
=
'\0'
;
p_msg
=
realloc
(
answer
->
p_body
,
strlen
((
char
*
)
answer
->
p_body
)
+
1
);
if
(
p_msg
)
{
answer
->
i_body
=
strlen
((
char
*
)
answer
->
p_body
)
+
1
;
answer
->
i_body
=
strlen
((
char
*
)
answer
->
p_body
)
+
1
;
answer
->
p_body
=
realloc
(
answer
->
p_body
,
answer
->
i_body
);
answer
->
p_body
=
p_msg
;
}
}
}
}
}
...
...
src/network/io.c
View file @
ec5d8611
...
@@ -507,8 +507,15 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
...
@@ -507,8 +507,15 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
{
{
if
(
i_line
==
i_max
)
if
(
i_line
==
i_max
)
{
{
char
*
psz_tmp
;
i_max
+=
1024
;
i_max
+=
1024
;
psz_line
=
realloc
(
psz_line
,
i_max
);
psz_tmp
=
realloc
(
psz_line
,
i_max
);
if
(
!
psz_tmp
)
{
free
(
psz_line
);
return
NULL
;
}
psz_line
=
psz_tmp
;
ptr
=
psz_line
+
i_line
;
ptr
=
psz_line
+
i_line
;
}
}
...
...
src/playlist/fetcher.c
View file @
ec5d8611
...
@@ -278,15 +278,17 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
...
@@ -278,15 +278,17 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
int
i_data
=
0
;
int
i_data
=
0
;
for
(
;;
)
for
(
;;
)
{
{
uint8_t
*
p_tmp
;
int
i_read
=
65536
;
int
i_read
=
65536
;
if
(
i_data
>=
INT_MAX
-
i_read
)
if
(
i_data
>=
INT_MAX
-
i_read
)
break
;
break
;
p_
data
=
realloc
(
p_data
,
i_data
+
i_read
);
p_
tmp
=
realloc
(
p_data
,
i_data
+
i_read
);
if
(
!
p_
data
)
if
(
!
p_
tmp
)
break
;
break
;
p_data
=
p_tmp
;
i_read
=
stream_Read
(
p_stream
,
&
p_data
[
i_data
],
i_read
);
i_read
=
stream_Read
(
p_stream
,
&
p_data
[
i_data
],
i_read
);
if
(
i_read
<=
0
)
if
(
i_read
<=
0
)
break
;
break
;
...
...
src/text/strings.c
View file @
ec5d8611
...
@@ -699,12 +699,17 @@ char *str_format_time( const char *tformat )
...
@@ -699,12 +699,17 @@ char *str_format_time( const char *tformat )
#define INSERT_STRING( string ) \
#define INSERT_STRING( string ) \
if( string != NULL ) \
if( string != NULL ) \
{ \
{ \
char *tmp; \
int len = strlen( string ); \
int len = strlen( string ); \
dst = realloc( dst, i_size = i_size + len );\
tmp = realloc( dst, i_size = i_size + len );\
if( tmp ) \
{ \
dst = tmp; \
memcpy( (dst+d), string, len ); \
memcpy( (dst+d), string, len ); \
d += len; \
d += len; \
free( string ); \
free( string ); \
} \
} \
} \
else if( !b_empty_if_na ) \
else if( !b_empty_if_na ) \
{ \
{ \
*(dst+d) = '-'; \
*(dst+d) = '-'; \
...
@@ -714,10 +719,15 @@ char *str_format_time( const char *tformat )
...
@@ -714,10 +719,15 @@ char *str_format_time( const char *tformat )
/* same than INSERT_STRING, except that string won't be freed */
/* same than INSERT_STRING, except that string won't be freed */
#define INSERT_STRING_NO_FREE( string ) \
#define INSERT_STRING_NO_FREE( string ) \
{ \
{ \
char *tmp; \
int len = strlen( string ); \
int len = strlen( string ); \
dst = realloc( dst, i_size = i_size + len );\
tmp = realloc( dst, i_size = i_size + len );\
if( tmp ) \
{ \
dst = tmp; \
memcpy( dst+d, string, len ); \
memcpy( dst+d, string, len ); \
d += len; \
d += len; \
} \
}
}
char
*
__str_format_meta
(
vlc_object_t
*
p_object
,
const
char
*
string
)
char
*
__str_format_meta
(
vlc_object_t
*
p_object
,
const
char
*
string
)
{
{
...
...
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