summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sndiod/dev.c4
-rw-r--r--usr.bin/sndiod/midi.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index 9715622791d..899daee81cb 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.20 2015/11/23 12:24:21 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.21 2015/11/25 18:47:12 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -976,6 +976,7 @@ dev_new(char *path, struct aparams *par,
return NULL;
}
d = xmalloc(sizeof(struct dev));
+ d->path = xstrdup(path);
d->num = dev_sndnum++;
/*
@@ -1258,6 +1259,7 @@ dev_del(struct dev *d)
}
midi_del(d->midi);
*p = d->next;
+ xfree(d->path);
xfree(d);
}
diff --git a/usr.bin/sndiod/midi.c b/usr.bin/sndiod/midi.c
index 2c7b4c1d01d..ad73fc56671 100644
--- a/usr.bin/sndiod/midi.c
+++ b/usr.bin/sndiod/midi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: midi.c,v 1.13 2015/11/23 18:16:41 ratchov Exp $ */
+/* $OpenBSD: midi.c,v 1.14 2015/11/25 18:47:12 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -427,7 +427,7 @@ port_new(char *path, unsigned int mode, int hold)
struct port *c;
c = xmalloc(sizeof(struct port));
- c->path = path;
+ c->path = xstrdup(path);
c->state = PORT_CFG;
c->hold = hold;
c->midi = midi_new(&port_midiops, c, mode);
@@ -457,6 +457,7 @@ port_del(struct port *c)
#endif
}
*p = c->next;
+ xfree(c->path);
xfree(c);
}