mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
free regex_t after use
This commit is contained in:
parent
15cebbaceb
commit
9996213c41
1 changed files with 11 additions and 4 deletions
|
|
@ -693,6 +693,7 @@ void pa_reset_priority(void) {
|
||||||
static int match(const char *expr, const char *v) {
|
static int match(const char *expr, const char *v) {
|
||||||
int k;
|
int k;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
|
int r;
|
||||||
|
|
||||||
if (regcomp(&re, expr, REG_NOSUB|REG_EXTENDED) != 0) {
|
if (regcomp(&re, expr, REG_NOSUB|REG_EXTENDED) != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
@ -700,12 +701,18 @@ static int match(const char *expr, const char *v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((k = regexec(&re, v, 0, NULL, 0)) == 0)
|
if ((k = regexec(&re, v, 0, NULL, 0)) == 0)
|
||||||
return 1;
|
r = 1;
|
||||||
else if (k == REG_NOMATCH)
|
else if (k == REG_NOMATCH)
|
||||||
return 0;
|
r = 0;
|
||||||
|
else
|
||||||
|
r = -1;
|
||||||
|
|
||||||
errno = EINVAL;
|
regfree(&re);
|
||||||
return -1;
|
|
||||||
|
if (r < 0)
|
||||||
|
errno = EINVAL;
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to parse a boolean string value.*/
|
/* Try to parse a boolean string value.*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue