zsh-workers
 help / color / mirror / code / Atom feed
From: Thorsten Meinecke <kaefer@aglaia.snafu.DE>
To: zsh-workers@math.gatech.edu
Subject: Re: compctl bug with beta17 on Linux
Date: Thu, 9 May 1996 16:15:42 +0200 (MET DST)	[thread overview]
Message-ID: <m0uHWVN-00008aC@aglaia.snafu.DE> (raw)
In-Reply-To: <199605090005.CAA00564@hzoli.ppp.cs.elte.hu> from "Zoltan Hidvegi" at May 9, 96 02:05:07 am

In <zsh-workers@math.gatech.edu> archive/latest/1024,
Zoltan Hidvegi <hzoli@cs.elte.hu> wrote:

> The problem is that cmdstr is initialised in the middle of get_comp_string
> using dupstring() and there is a pushheap() before this and a pophheap()
> after this.  This means that cmdstr will be freed before returning from
> get_comp_string().

Methinks cmdstr is freed by freeheap() in docomplete(), in this case.

> [...] After that, the fix is trivial.

I beg to differ :-)  Stylistical issues aside (freeing a char* before
ever using it, even if it's guaranteed to be initialised with NULL),
Zoltan's patch will fall over, when for whatever reason there's more than
one command position considered in the do/while-loop in get_comp_string().
Invariably this will lead to memory leaks.  For example, when quotes and
newlines are involved:

% somecommand "
> anystring "
            ^ here's the cursor, and completion is requested

cmdstr will point to "anystring", but the memory occupied previously by
"somecommand" won't never be released.  That "anystring" is the result
might be seen as a bug in its own right, but who says that something like
this will never happen?

Your humble servant,
Thorsten



  reply	other threads:[~1996-05-09 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-08  9:44 Hrvoje Niksic
1996-05-08 23:51 ` Thorsten Meinecke
1996-05-09  0:05 ` Zoltan Hidvegi
1996-05-09 14:15   ` Thorsten Meinecke [this message]
1996-05-09 21:01     ` Zoltan Hidvegi

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=m0uHWVN-00008aC@aglaia.snafu.DE \
    --to=kaefer@aglaia.snafu.de \
    --cc=zsh-workers@math.gatech.edu \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).