Skip to content

Commit 5c4c0d4

Browse files
committed
extend cleanup_metafile() and free hash
1 parent 765f275 commit 5c4c0d4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

init.c

+2
Original file line numberDiff line numberDiff line change
@@ -551,4 +551,6 @@ EXPORT void cleanup_metafile(struct metafile *m)
551551
ll_free(m->file_list, file_data_clear);
552552

553553
ll_free(m->web_seed_list, NULL);
554+
555+
free(m->metainfo_file_path);
554556
}

main.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,18 @@ int main(int argc, char *argv[])
138138
_after_ we did all the hashing in case we fail */
139139
file = open_file(m.metainfo_file_path);
140140

141-
/* calculate hash string and write the metainfo to file */
142-
write_metainfo(file, &m, make_hash(&m));
141+
/* calculate hash string... */
142+
unsigned char *hash = make_hash(&m);
143143

144+
/* and write the metainfo to file */
145+
write_metainfo(file, &m, hash);
146+
144147
/* close the file stream */
145148
close_file(file);
146149

147150
/* free allocated memory */
148151
cleanup_metafile(&m);
152+
free(hash);
149153

150154
/* yeih! everything seemed to go as planned */
151155
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)