[vlc-commits] [Git][videolan/vlc][master] 3 commits: aout: pipewire: check pw_properties_new() failure
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Mar 6 10:23:27 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b133159f by Johannes Kauffmann at 2025-03-06T10:02:48+00:00
aout: pipewire: check pw_properties_new() failure
- - - - -
5f8d7eea by Johannes Kauffmann at 2025-03-06T10:02:48+00:00
aout: pipewire: free properties on malloc failure
vlc_pw_stream_new() / pw_stream_new() takes ownership of props, but we
need to delete the properties ourselves in case of any error before that
function is called.
- - - - -
0aff4825 by Johannes Kauffmann at 2025-03-06T10:02:48+00:00
access: pipewire: don't free properties twice
vlc_pw_stream_new() / pw_stream_new() takes ownership of props and calls
pw_properties_free() in case of any error.
- - - - -
2 changed files:
- modules/access/pipewire.c
- modules/audio_output/pipewire.c
Changes:
=====================================
modules/access/pipewire.c
=====================================
@@ -588,7 +588,6 @@ static int Open(vlc_object_t *obj)
{
vlc_pw_unlock(s->context);
free(s);
- pw_properties_free(props);
vlc_pw_disconnect(sys->context);
free(sys);
return VLC_EGENERIC;
=====================================
modules/audio_output/pipewire.c
=====================================
@@ -578,20 +578,22 @@ static struct vlc_pw_stream *vlc_pw_stream_create(audio_output_t *aout,
props = pw_properties_new(PW_KEY_MEDIA_TYPE, "Audio",
PW_KEY_MEDIA_CATEGORY, "Playback",
NULL);
+ if (unlikely(props == NULL))
+ return NULL;
- if (likely(props != NULL)) {
- char *role = var_InheritString(aout, "role");
- if (role != NULL) { /* Capitalise the first character */
- pw_properties_setf(props, PW_KEY_MEDIA_ROLE, "%c%s",
- toupper((unsigned char)role[0]), role + 1);
- free(role);
- }
+ char *role = var_InheritString(aout, "role");
+ if (role != NULL) { /* Capitalise the first character */
+ pw_properties_setf(props, PW_KEY_MEDIA_ROLE, "%c%s",
+ toupper((unsigned char)role[0]), role + 1);
+ free(role);
}
/* Create the stream */
struct vlc_pw_stream *s = malloc(sizeof (*s));
- if (unlikely(s == NULL))
+ if (unlikely(s == NULL)) {
+ pw_properties_free(props);
return NULL;
+ }
enum pw_stream_flags flags =
PW_STREAM_FLAG_AUTOCONNECT |
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8befcbfa834b809602db24c9ba7456d8cfc25cdb...0aff482568bd0cc61457a0d9f335985641902411
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8befcbfa834b809602db24c9ba7456d8cfc25cdb...0aff482568bd0cc61457a0d9f335985641902411
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list