mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fix memory leak
This commit is contained in:
parent
381ae769db
commit
382094a6e8
|
@ -308,10 +308,13 @@ static int store_data(char *path)
|
||||||
|
|
||||||
fd = fopen(path, "w");
|
fd = fopen(path, "w");
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
|
free(buf);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwrite(buf, len, 1, fd) != 1) {
|
if (fwrite(buf, len, 1, fd) != 1) {
|
||||||
|
free(buf);
|
||||||
|
fclose(fd);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user