mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-30 07:34:27 +08:00
Fix some memory leaks in textfile.c
This commit is contained in:
parent
b54cf7efa1
commit
50d400b1de
@ -219,6 +219,7 @@ static int write_key(const char *pathname, const char *key, const char *value, i
|
|||||||
munmap(map, size);
|
munmap(map, size);
|
||||||
if (ftruncate(fd, base) < 0) {
|
if (ftruncate(fd, base) < 0) {
|
||||||
err = errno;
|
err = errno;
|
||||||
|
free(str);
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
pos = lseek(fd, base, SEEK_SET);
|
pos = lseek(fd, base, SEEK_SET);
|
||||||
@ -384,6 +385,7 @@ int textfile_foreach(const char *pathname,
|
|||||||
end = strpbrk(off, "\r\n");
|
end = strpbrk(off, "\r\n");
|
||||||
if (!end) {
|
if (!end) {
|
||||||
err = EILSEQ;
|
err = EILSEQ;
|
||||||
|
free(key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,6 +394,7 @@ int textfile_foreach(const char *pathname,
|
|||||||
value = malloc(len + 1);
|
value = malloc(len + 1);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
err = errno;
|
err = errno;
|
||||||
|
free(key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user