summaryrefslogtreecommitdiff
path: root/libmailutils
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-05-23 12:50:07 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-05-23 12:50:07 +0300
commit99fc551710c50ff93c2514938013562bfc707f60 (patch)
tree9b6af3e8ff5a8025dbc70800dd9c89eaca720f98 /libmailutils
parentb2ba2052a94f658284875d03e54ea1ac83c29d1c (diff)
downloadmailutils-99fc551710c50ff93c2514938013562bfc707f60.tar.gz
mailutils-99fc551710c50ff93c2514938013562bfc707f60.tar.bz2
fix memory leak in folder scanner
* libmailutils/mailbox/folder.c (mu_folder_enumerate): Set the destroy_item function on the created list. * libmailutils/mailbox/fsfolder.c (list_helper): Free the resp structure when it is no longer needed.
Diffstat (limited to 'libmailutils')
-rw-r--r--libmailutils/mailbox/folder.c1
-rw-r--r--libmailutils/mailbox/fsfolder.c5
2 files changed, 3 insertions, 3 deletions
diff --git a/libmailutils/mailbox/folder.c b/libmailutils/mailbox/folder.c
index 76c296a85..4b3115c8a 100644
--- a/libmailutils/mailbox/folder.c
+++ b/libmailutils/mailbox/folder.c
@@ -392,6 +392,7 @@ mu_folder_enumerate (mu_folder_t folder, const char *name,
status = mu_list_create (&scn.result);
if (status)
return status;
+ mu_list_set_destroy_item (scn.result, mu_list_response_free);
}
status = mu_folder_scan (folder, &scn);
if (status == 0)
diff --git a/libmailutils/mailbox/fsfolder.c b/libmailutils/mailbox/fsfolder.c
index 0b3e59a4a..603388f76 100644
--- a/libmailutils/mailbox/fsfolder.c
+++ b/libmailutils/mailbox/fsfolder.c
@@ -387,8 +387,7 @@ list_helper (struct mu_folder_scanner *scn,
{
if (scn->enumfun (data->folder, resp, scn->enumdata))
{
- free (resp->name);
- free (resp);
+ mu_list_response_free (resp);
stop = 1;
break;
}
@@ -410,7 +409,7 @@ list_helper (struct mu_folder_scanner *scn,
fname = NULL;
}
else
- free (resp);
+ mu_list_response_free (resp);
}
if ((type & MU_FOLDER_ATTRIBUTE_DIRECTORY)

Return to:

Send suggestions and report system problems to the System administrator.