mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-16 23:23:11 +01:00
notmuch restore: Fix leak of FILE* object.
Apparently, I didn't copy enough of the "notmuch dump" implementation since it didn't have a similar leak.
This commit is contained in:
parent
789495919a
commit
46ba33b115
1 changed files with 5 additions and 3 deletions
|
@ -668,7 +668,7 @@ show_command (unused (int argc), unused (char *argv[]))
|
||||||
static int
|
static int
|
||||||
dump_command (int argc, char *argv[])
|
dump_command (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *output;
|
FILE *output = NULL;
|
||||||
notmuch_database_t *notmuch = NULL;
|
notmuch_database_t *notmuch = NULL;
|
||||||
notmuch_query_t *query;
|
notmuch_query_t *query;
|
||||||
notmuch_message_results_t *results;
|
notmuch_message_results_t *results;
|
||||||
|
@ -735,7 +735,7 @@ dump_command (int argc, char *argv[])
|
||||||
DONE:
|
DONE:
|
||||||
if (notmuch)
|
if (notmuch)
|
||||||
notmuch_database_close (notmuch);
|
notmuch_database_close (notmuch);
|
||||||
if (output != stdout)
|
if (output && output != stdout)
|
||||||
fclose (output);
|
fclose (output);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -744,7 +744,7 @@ dump_command (int argc, char *argv[])
|
||||||
static int
|
static int
|
||||||
restore_command (int argc, char *argv[])
|
restore_command (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *input;
|
FILE *input = NULL;
|
||||||
notmuch_database_t *notmuch = NULL;
|
notmuch_database_t *notmuch = NULL;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t line_size;
|
size_t line_size;
|
||||||
|
@ -845,6 +845,8 @@ restore_command (int argc, char *argv[])
|
||||||
free (line);
|
free (line);
|
||||||
if (notmuch)
|
if (notmuch)
|
||||||
notmuch_database_close (notmuch);
|
notmuch_database_close (notmuch);
|
||||||
|
if (input && input != stdin)
|
||||||
|
fclose (input);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue