Apparently, I didn't copy enough of the "notmuch dump" implementation
since it didn't have a similar leak.
static int
dump_command (int argc, char *argv[])
{
static int
dump_command (int argc, char *argv[])
{
notmuch_database_t *notmuch = NULL;
notmuch_query_t *query;
notmuch_message_results_t *results;
notmuch_database_t *notmuch = NULL;
notmuch_query_t *query;
notmuch_message_results_t *results;
DONE:
if (notmuch)
notmuch_database_close (notmuch);
DONE:
if (notmuch)
notmuch_database_close (notmuch);
+ if (output && output != stdout)
fclose (output);
return ret;
fclose (output);
return ret;
static int
restore_command (int argc, char *argv[])
{
static int
restore_command (int argc, char *argv[])
{
notmuch_database_t *notmuch = NULL;
char *line = NULL;
size_t line_size;
notmuch_database_t *notmuch = NULL;
char *line = NULL;
size_t line_size;
free (line);
if (notmuch)
notmuch_database_close (notmuch);
free (line);
if (notmuch)
notmuch_database_close (notmuch);
+ if (input && input != stdin)
+ fclose (input);