mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:33:02 +01:00
fix memory leak
This commit is contained in:
parent
1158930641
commit
076ea43c07
3
main.c
3
main.c
@ -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