1
0
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:
Michael Rose 2013-08-14 09:31:19 +02:00
parent 1158930641
commit 076ea43c07

3
main.c
View File

@ -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;
} }