mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 22:23:08 +00:00
mixer: Fix a bogus free() call in the main loop
After a strsep() call, p might not point at the original allocation anymore. Reported by: CHERI Reviewed by: christos MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47266
This commit is contained in:
parent
9b2f2fbfcb
commit
c22be0b181
@ -147,7 +147,9 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
parse:
|
parse:
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if ((p = strdup(*argv)) == NULL)
|
char *orig;
|
||||||
|
|
||||||
|
if ((orig = p = strdup(*argv)) == NULL)
|
||||||
err(1, "strdup(%s)", *argv);
|
err(1, "strdup(%s)", *argv);
|
||||||
|
|
||||||
/* Check if we're using the shorthand syntax for volume setting. */
|
/* Check if we're using the shorthand syntax for volume setting. */
|
||||||
@ -200,7 +202,7 @@ parse:
|
|||||||
/* Input: `dev.control=val`. */
|
/* Input: `dev.control=val`. */
|
||||||
cp->mod(cp->parent_dev, valstr);
|
cp->mod(cp->parent_dev, valstr);
|
||||||
next:
|
next:
|
||||||
free(p);
|
free(orig);
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user