mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
pactl: Fix some corner cases when setting sink formats
Mostly deals with failure more gracefully, and NULL-initialises the format array for safety.
This commit is contained in:
parent
24c389c8aa
commit
9e0aa31f0a
1 changed files with 3 additions and 3 deletions
|
|
@ -1045,7 +1045,7 @@ static void source_output_toggle_mute_callback(pa_context *c, const pa_source_ou
|
||||||
#define MAX_FORMATS 256
|
#define MAX_FORMATS 256
|
||||||
|
|
||||||
static void set_sink_formats(pa_context *c, uint32_t sink, const char *str) {
|
static void set_sink_formats(pa_context *c, uint32_t sink, const char *str) {
|
||||||
pa_format_info *f_arr[MAX_FORMATS];
|
pa_format_info *f_arr[MAX_FORMATS] = { 0, };
|
||||||
char *format = NULL;
|
char *format = NULL;
|
||||||
const char *state = NULL;
|
const char *state = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
@ -1072,13 +1072,13 @@ static void set_sink_formats(pa_context *c, uint32_t sink, const char *str) {
|
||||||
done:
|
done:
|
||||||
if (format)
|
if (format)
|
||||||
pa_xfree(format);
|
pa_xfree(format);
|
||||||
while(i--)
|
while (f_arr[i] && i--)
|
||||||
pa_format_info_free(f_arr[i]);
|
pa_format_info_free(f_arr[i]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
while(i--)
|
while (f_arr[i] && i--)
|
||||||
pa_format_info_free(f_arr[i]);
|
pa_format_info_free(f_arr[i]);
|
||||||
quit(1);
|
quit(1);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue