diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-19 19:52:48 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-19 19:54:14 +0200 |
commit | a48c2cf4e5a9136bf23f4d73a5fe141ebf180e1a (patch) | |
tree | 0123372f6992d504ed2311abfee111a31d1a8613 /paswitch.c | |
parent | f79a8d38fb97443e6c64196b084253c96fd0391c (diff) | |
download | desktop-tools-a48c2cf4e5a9136bf23f4d73a5fe141ebf180e1a.tar.gz desktop-tools-a48c2cf4e5a9136bf23f4d73a5fe141ebf180e1a.tar.xz desktop-tools-a48c2cf4e5a9136bf23f4d73a5fe141ebf180e1a.zip |
Bump liberty
The bugfixes in the config parser are worth it.
I might have slightly overused cstr_set().
Diffstat (limited to 'paswitch.c')
-rw-r--r-- | paswitch.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -46,13 +46,6 @@ enum { PIPE_READ, PIPE_WRITE }; static void -cstr_set (char **s, char *new) -{ - free (*s); - *s = new; -} - -static void log_message_custom (void *user_data, const char *quote, const char *fmt, va_list ap) { @@ -79,8 +72,8 @@ struct port static void port_free (struct port *self) { - free (self->name); - free (self->description); + cstr_set (&self->name, NULL); + cstr_set (&self->description, NULL); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -109,14 +102,14 @@ sink_new (void) static void sink_destroy (struct sink *self) { - free (self->name); - free (self->description); + cstr_set (&self->name, NULL); + cstr_set (&self->description, NULL); for (size_t i = 0; i < self->ports_len; i++) port_free (self->ports + i); free (self->ports); - free (self->port_active); + cstr_set (&self->port_active, NULL); free (self); } @@ -185,7 +178,7 @@ app_context_free (struct app_context *self) if (self->context) pa_context_unref (self->context); - free (self->default_sink); + cstr_set (&self->default_sink, NULL); LIST_FOR_EACH (struct sink, iter, self->sinks) sink_destroy (iter); LIST_FOR_EACH (struct sink_input, iter, self->inputs) |