Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
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
libdvbpsi
Commits
afca8c8e
Commit
afca8c8e
authored
Apr 16, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/dvbpsi.c: Use va_end() on error path of message functions.
parent
e74393dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
src/dvbpsi.c
src/dvbpsi.c
+14
-4
No files found.
src/dvbpsi.c
View file @
afca8c8e
...
...
@@ -527,9 +527,12 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
int
err
=
vasprintf
(
&
msg
,
fmt
,
ap
);
#else
msg
=
malloc
(
DVBPSI_MSG_SIZE
);
if
(
msg
==
NULL
)
if
(
msg
==
NULL
)
{
va_end
(
ap
);
return
;
}
if
(
snprintf
(
&
msg
,
DVBPSI_MSG_SIZE
,
DVBPSI_MSG_FORMAT
,
ap
)
<
0
)
{
va_end
(
ap
);
free
(
msg
);
return
;
}
...
...
@@ -553,10 +556,13 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
va_start(ap, fmt); \
char *tmp = NULL; \
int err = vasprintf(&tmp, fmt, ap); \
if (err < 0) \
if (err < 0) { \
va_end(ap); \
return; \
} \
char *msg = NULL; \
if (asprintf(&msg, DVBPSI_MSG_FORMAT, src, tmp) < 0) { \
va_end(ap); \
free(tmp); \
return; \
} \
...
...
@@ -574,10 +580,14 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
va_list ap; \
va_start(ap, fmt); \
char *msg = malloc(DVBPSI_MSG_SIZE); \
if (msg == NULL) \
if (msg == NULL) { \
va_end(ap); \
return; \
if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, src) < 0) \
} \
if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, src) < 0) { \
va_end(ap); \
return; \
} \
int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); \
va_end(ap); \
if (err > 0) { \
...
...
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