fix memory leak

This commit is contained in:
Michael Rose 2013-08-14 09:31:19 +02:00
parent 381ae769db
commit 382094a6e8

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