mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
Fix checking for NULL after usage
The pa_xmalloc calls oom() in case of NULL pointer returned by malloc() on one hand and dereferencing of pointer is happen early than actual check on other hand. Thus, just remove useless checks.
This commit is contained in:
parent
ae383539d7
commit
300384ce0a
4 changed files with 9 additions and 18 deletions
|
|
@ -239,13 +239,10 @@ pa_operation *pa_ext_stream_restore_write(
|
|||
return o;
|
||||
|
||||
fail:
|
||||
if (o) {
|
||||
pa_operation_cancel(o);
|
||||
pa_operation_unref(o);
|
||||
}
|
||||
pa_operation_cancel(o);
|
||||
pa_operation_unref(o);
|
||||
|
||||
if (t)
|
||||
pa_tagstruct_free(t);
|
||||
pa_tagstruct_free(t);
|
||||
|
||||
pa_context_set_error(c, PA_ERR_INVALID);
|
||||
return NULL;
|
||||
|
|
@ -290,13 +287,10 @@ pa_operation *pa_ext_stream_restore_delete(
|
|||
return o;
|
||||
|
||||
fail:
|
||||
if (o) {
|
||||
pa_operation_cancel(o);
|
||||
pa_operation_unref(o);
|
||||
}
|
||||
pa_operation_cancel(o);
|
||||
pa_operation_unref(o);
|
||||
|
||||
if (t)
|
||||
pa_tagstruct_free(t);
|
||||
pa_tagstruct_free(t);
|
||||
|
||||
pa_context_set_error(c, PA_ERR_INVALID);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -627,8 +627,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp
|
|||
return;
|
||||
|
||||
fail:
|
||||
if (c)
|
||||
connection_unlink(c);
|
||||
connection_unlink(c);
|
||||
}
|
||||
|
||||
void pa_simple_protocol_disconnect(pa_simple_protocol *p, pa_module *m) {
|
||||
|
|
|
|||
|
|
@ -299,8 +299,7 @@ pa_resampler* pa_resampler_new(
|
|||
return r;
|
||||
|
||||
fail:
|
||||
if (r)
|
||||
pa_xfree(r);
|
||||
pa_xfree(r);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,8 +334,7 @@ int pa_play_file(
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
if (u)
|
||||
file_stream_unref(u);
|
||||
file_stream_unref(u);
|
||||
|
||||
if (fd >= 0)
|
||||
pa_close(fd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue