From: "Gary Yee" <gary@pressler.com>
To: <gnats-devel@sourceware.cygnus.com>
Subject: potential memory leaks
Date: Wed, 12 Jan 2000 18:17:00 -0000 [thread overview]
Message-ID: <00f501bf5d5b$b5836ec0$6500a8c0@nss.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]
Hi!
I'm currently looking over the code for version
3.113 of GNATS. I think there are some potential memory
leaks.
Â
Here is some code from main.c:
Â
 /* Check if the message is a reply to an
existing PR; if it is, then
   just append this message to
the end of that PR. Otherwise, process
   it normally. */
 pr_path = check_if_reply ();
 if (pr_path)
  {
  /* Before inserting the reply, see
if someone's got the PR
      locked; if
they do, then try it at the next run of the queue. */
    char *buf =
get_lock_path (pr_path);
    if (access (buf, R_OK)
== 0)
     Â
{
       Â
unlock_gnats ();
       Â
exit (1);
     Â
}
    append_report (fp,
pr_path);
    xfree
(pr_path);
  }
 else
  gnats (fp);
Â
 /* Clean up. */
 if (log_method == MAIL)
   close_mail_file
(gnats_logfile);
#ifdef HAVE_SYSLOG_H
 else if (log_method ==
SYSLOG)
   closelog ();
#endif
Â
 /* unlock the whole thing. */
 unlock_gnats ();
 free_db_conf();
 exit (0);
}
Â
If the call to access() returns 0, which means that
the PR is already locked, shouldn't there be calls to close_mail_file(),
free_db_conf(), and xfree() along with the call to unlock_gnats()?
Â
In headers.c, the call to set_continued_header() is
immediately followed by the line
Â
   buf = NULL;
Â
This assumes that the memory originally pointed to
by buf gets assigned to something in the set_continued_header function.Â
This is true except when header[i].value is not NULL and (keep_rec && i
== RECEIVED) is false. In this case, nothing is done with
buf.
Â
That's all for now.
Â
Regards,
Gary
Â
next reply other threads:[~2000-01-12 18:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-12 18:17 Gary Yee [this message]
2000-01-12 18:57 ` Rick Macdonald
2000-01-26 13:07 ` Bob Manson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00f501bf5d5b$b5836ec0$6500a8c0@nss.com' \
--to=gary@pressler.com \
--cc=gnats-devel@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).