1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

nwrap: Fix memory leak when getline() is used.

getline() allocates memory even if return code is < 0.

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Robin Hack 2015-10-08 11:36:33 +02:00 committed by Michael Adam
parent 4505dcd646
commit 9d71542cd9

View File

@ -1705,6 +1705,7 @@ static bool nwrap_parse_file(struct nwrap_cache *nwrap)
do { do {
n = getline(&line, &len, nwrap->fp); n = getline(&line, &len, nwrap->fp);
if (n < 0) { if (n < 0) {
SAFE_FREE(line);
if (feof(nwrap->fp)) { if (feof(nwrap->fp)) {
break; break;
} }