diff options
author | Michael Rose <michael_rose@gmx.de> | 2013-08-14 09:31:19 +0200 |
---|---|---|
committer | Michael Rose <michael_rose@gmx.de> | 2013-08-14 09:31:19 +0200 |
commit | 382094a6e85a4ebb05b88c3ce1e0255b52061bb1 (patch) | |
tree | 5928648b383d7e3fdf42729d0e6671782082c366 /testing | |
parent | 381ae769db0747de88ecd02decf7fbde44a4c6b9 (diff) |
fix memory leak
Diffstat (limited to 'testing')
-rw-r--r-- | testing/toxic/main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 27a34e09..fd3c732f 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -308,10 +308,13 @@ static int store_data(char *path) | |||
308 | 308 | ||
309 | fd = fopen(path, "w"); | 309 | fd = fopen(path, "w"); |
310 | if (fd == NULL) { | 310 | if (fd == NULL) { |
311 | free(buf); | ||
311 | return 2; | 312 | return 2; |
312 | } | 313 | } |
313 | 314 | ||
314 | if (fwrite(buf, len, 1, fd) != 1) { | 315 | if (fwrite(buf, len, 1, fd) != 1) { |
316 | free(buf); | ||
317 | fclose(fd); | ||
315 | return 3; | 318 | return 3; |
316 | } | 319 | } |
317 | 320 | ||