mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 15:43:35 -04:00
Merge branch 'free-strdup-memory-in-selftests'
Geliang Tang says: ==================== Free strdup memory in selftests From: Geliang Tang <tanggeliang@kylinos.cn> Two fixes to free strdup memory in selftests to avoid memory leaks. ==================== Link: https://lore.kernel.org/r/cover.1714374022.git.tanggeliang@kylinos.cn Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
@@ -1887,10 +1887,13 @@ static int check_whitelist(struct _test *t, struct sockmap_options *opt)
|
||||
while (entry) {
|
||||
if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
|
||||
strstr(opt->map, entry) != 0 ||
|
||||
strstr(t->title, entry) != 0)
|
||||
strstr(t->title, entry) != 0) {
|
||||
free(ptr);
|
||||
return 0;
|
||||
}
|
||||
entry = strtok(NULL, ",");
|
||||
}
|
||||
free(ptr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1907,10 +1910,13 @@ static int check_blacklist(struct _test *t, struct sockmap_options *opt)
|
||||
while (entry) {
|
||||
if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
|
||||
strstr(opt->map, entry) != 0 ||
|
||||
strstr(t->title, entry) != 0)
|
||||
strstr(t->title, entry) != 0) {
|
||||
free(ptr);
|
||||
return 0;
|
||||
}
|
||||
entry = strtok(NULL, ",");
|
||||
}
|
||||
free(ptr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -792,10 +792,13 @@ static int parse_stats(const char *stats_str, struct stat_specs *specs)
|
||||
|
||||
while ((next = strtok_r(state ? NULL : input, ",", &state))) {
|
||||
err = parse_stat(next, specs);
|
||||
if (err)
|
||||
if (err) {
|
||||
free(input);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
free(input);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user