summaryrefslogtreecommitdiffstats
path: root/src/psearchn.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-01-23 10:29:04 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2016-01-23 10:29:04 +0100
commit7a035acdd1ab72e63af8661aad791cb59d2cb8ed (patch)
tree2c9f0c2dc819e41fea28b046520bfa9131f64a99 /src/psearchn.c
parent0675f6f68315c76cc3019e6fa4f34575eee793e1 (diff)
Avoid a file descriptor leak when stopping and resuming PhotoRec
Diffstat (limited to 'src/psearchn.c')
-rw-r--r--src/psearchn.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/psearchn.c b/src/psearchn.c
index ef094e5..c614629 100644
--- a/src/psearchn.c
+++ b/src/psearchn.c
@@ -347,9 +347,11 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options
if(ind_stop!=PSTATUS_OK)
{
log_info("PhotoRec has been stopped\n");
- current_search_space=list_search_space;
+ file_recovery_aborted(&file_recovery, params, list_search_space);
+ free(buffer_start);
+ return ind_stop;
}
- else if(file_recovered==PFSTATUS_BAD)
+ if(file_recovered==PFSTATUS_BAD)
{
if(res==DC_SCAN)
{
@@ -431,7 +433,9 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options
if(ind_stop!=PSTATUS_OK)
{
log_info("PhotoRec has been stopped\n");
- current_search_space=list_search_space;
+ file_recovery_aborted(&file_recovery, params, list_search_space);
+ free(buffer_start);
+ return ind_stop;
}
}
}