make sure we call va_end in all cases

This commit is contained in:
Wim Taymans 2020-05-20 15:14:26 +02:00
parent c2028a1695
commit 8123e271ec
2 changed files with 12 additions and 6 deletions

View file

@ -1449,16 +1449,18 @@ int pw_filter_set_error(struct pw_filter *filter,
if (res < 0) { if (res < 0) {
va_list args; va_list args;
char *value; char *value;
int r;
va_start(args, error); va_start(args, error);
if (vasprintf(&value, error, args) < 0) r = vasprintf(&value, error, args);
va_end(args);
if (r < 0)
return -errno; return -errno;
if (filter->proxy) if (filter->proxy)
pw_proxy_error(filter->proxy, res, value); pw_proxy_error(filter->proxy, res, value);
filter_set_state(filter, PW_FILTER_STATE_ERROR, value); filter_set_state(filter, PW_FILTER_STATE_ERROR, value);
va_end(args);
free(value); free(value);
} }
return res; return res;

View file

@ -1597,16 +1597,18 @@ int pw_stream_set_error(struct pw_stream *stream,
if (res < 0) { if (res < 0) {
va_list args; va_list args;
char *value; char *value;
int r;
va_start(args, error); va_start(args, error);
if (vasprintf(&value, error, args) < 0) r = vasprintf(&value, error, args);
va_end(args);
if (r < 0)
return -errno; return -errno;
if (stream->proxy) if (stream->proxy)
pw_proxy_error(stream->proxy, res, value); pw_proxy_error(stream->proxy, res, value);
stream_set_state(stream, PW_STREAM_STATE_ERROR, value); stream_set_state(stream, PW_STREAM_STATE_ERROR, value);
va_end(args);
free(value); free(value);
} }
return res; return res;
@ -1640,7 +1642,7 @@ int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_valu
struct spa_pod *pod; struct spa_pod *pod;
struct control *c; struct control *c;
va_start(varargs, values); va_start(varargs, values);
spa_pod_builder_push_object(&b, &f[0], SPA_TYPE_OBJECT_Props, SPA_PARAM_Props); spa_pod_builder_push_object(&b, &f[0], SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
while (1) { while (1) {
@ -1674,6 +1676,8 @@ int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_valu
} }
pod = spa_pod_builder_pop(&b, &f[0]); pod = spa_pod_builder_pop(&b, &f[0]);
va_end(varargs);
pw_impl_node_set_param(impl->node, SPA_PARAM_Props, 0, pod); pw_impl_node_set_param(impl->node, SPA_PARAM_Props, 0, pod);
return 0; return 0;