summaryrefslogtreecommitdiff
path: root/mh
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-05-20 10:43:25 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-05-20 10:43:25 +0000
commit81df3b518fbf75717b4013126e200ee0c256e244 (patch)
tree3219beda9fab278ffd73c6b72f1fb4e6537445ff /mh
parent7125b13cdb23c4504180949ebdadcb5e0efa2e6d (diff)
downloadmailutils-81df3b518fbf75717b4013126e200ee0c256e244.tar.gz
mailutils-81df3b518fbf75717b4013126e200ee0c256e244.tar.bz2
(mh_file_to_message): Fix a memory leak
Diffstat (limited to 'mh')
-rw-r--r--mh/mh_init.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/mh/mh_init.c b/mh/mh_init.c
index 816351694..cf6ace406 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -638,16 +638,13 @@ mh_file_copy (const char *from, const char *to)
return rc;
}
-mu_message_t
-mh_file_to_message (const char *folder, char *file_name)
+static mu_message_t
+_file_to_message (char *file_name)
{
struct stat st;
int rc;
mu_stream_t instream;
-
- if (folder)
- file_name = mh_expand_name (folder, file_name, 0);
-
+
if (stat (file_name, &st) < 0)
{
mu_error (_("Cannot stat file %s: %s"), file_name, strerror (errno));
@@ -672,6 +669,24 @@ mh_file_to_message (const char *folder, char *file_name)
return mh_stream_to_message (instream);
}
+mu_message_t
+mh_file_to_message (const char *folder, char *file_name)
+{
+ mu_message_t msg;
+ char *tmp_name = NULL;
+
+ if (folder)
+ {
+ tmp_name = mh_expand_name (folder, file_name, 0);
+ msg = _file_to_message (tmp_name);
+ free (tmp_name);
+ }
+ else
+ msg = _file_to_message (file_name);
+
+ return msg;
+}
+
void
mh_install_help (char *mhdir)
{

Return to:

Send suggestions and report system problems to the System administrator.