diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2006-09-13 14:58:58 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2006-09-13 14:58:58 +0000 | 
| commit | 50d400b1de38cbf75a2004a53e412dc6343d82bb (patch) | |
| tree | d4c0b7076e7db4af4786a82341494120a9de197f /common/textfile.c | |
| parent | b54cf7efa10d238fb6791275be13f4c1a66d19a9 (diff) | |
Fix some memory leaks in textfile.c
Diffstat (limited to 'common/textfile.c')
| -rw-r--r-- | common/textfile.c | 3 | 
1 files changed, 3 insertions, 0 deletions
| diff --git a/common/textfile.c b/common/textfile.c index d76398c4..8c46563c 100644 --- a/common/textfile.c +++ b/common/textfile.c @@ -219,6 +219,7 @@ static int write_key(const char *pathname, const char *key, const char *value, i  	munmap(map, size);  	if (ftruncate(fd, base) < 0) {  		err = errno; +		free(str);  		goto unlock;  	}  	pos = lseek(fd, base, SEEK_SET); @@ -384,6 +385,7 @@ int textfile_foreach(const char *pathname,  		end = strpbrk(off, "\r\n");  		if (!end) {  			err = EILSEQ; +			free(key);  			break;  		} @@ -392,6 +394,7 @@ int textfile_foreach(const char *pathname,  		value = malloc(len + 1);  		if (!value) {  			err = errno; +			free(key);  			break;  		} | 
