summaryrefslogtreecommitdiffstats
path: root/src/phbf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-10-28 11:22:22 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-10-28 11:22:22 +0100
commit319e5b55cb07b787f0f673a1ac0e7c72bf8f3d12 (patch)
tree935f5bb9c1726da726f75a89fb78c0b05d604474 /src/phbf.c
parent3e91667fb243d0f7518f425faf92a46a2cdf573b (diff)
PhotoRec: fix file descriptor leak when bruteforce mode is enabled
Diffstat (limited to 'src/phbf.c')
-rw-r--r--src/phbf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/phbf.c b/src/phbf.c
index 058dc08..cb0bf95 100644
--- a/src/phbf.c
+++ b/src/phbf.c
@@ -28,6 +28,9 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* unlink */
+#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -289,6 +292,12 @@ pstatus_t photorec_bf(struct ph_param *params, const struct ph_options *options,
#endif
}
}
+ if(file_recovery.handle!=NULL)
+ {
+ fclose(file_recovery.handle);
+ file_recovery.handle=NULL;
+ unlink(file_recovery.filename);
+ }
search_walker=p;
if(go_backward==0)
{