Merge pull request #7559 from evverx/incorrect-spec-memleak

shared: fix a memory leak
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-12-06 22:56:02 +01:00 committed by GitHub
commit 4dbb344fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -101,10 +101,11 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
ret = n;
t = n + j + k;
} else if (strchr(POSSIBLE_SPECIFIERS, *f))
} else if (strchr(POSSIBLE_SPECIFIERS, *f)) {
/* Oops, an unknown specifier. */
free(ret);
return -EBADSLT;
else {
} else {
*(t++) = '%';
*(t++) = *f;
}

View File

@ -28,12 +28,12 @@ try:
except AttributeError:
sys.exit(EXIT_TEST_SKIP)
exe = sys.argv[1]
exe_with_args = sys.argv[1:]
def test_line(line, *, user, returncode=EX_DATAERR, extra={}):
args = ['--user'] if user else []
print('Running {} {} on {!r}'.format(exe, ' '.join(args), line))
c = subprocess.run([exe, '--create', '-'] + args,
print('Running {} on {!r}'.format(' '.join(exe_with_args + args), line))
c = subprocess.run(exe_with_args + ['--create', '-'] + args,
input=line, stdout=subprocess.PIPE, universal_newlines=True,
**extra)
assert c.returncode == returncode, c