[Midnight Commander] #147: Fix escaping for completion on cmdline (spaces, backslashes, etc).

Ticket System tickets at midnight-commander.org
Thu Jan 8 12:06:04 UTC 2009


#147: Fix escaping for completion on cmdline (spaces, backslashes, etc).
---------------------------------------------------+------------------------
  Reporter:  Patrick Winnertz <winnie at debian.org>  |       Owner:  winnie  
      Type:  defect                                |      Status:  accepted
  Priority:  major                                 |   Milestone:  4.6.2   
 Component:  mc-core                               |     Version:  4.6.1   
Resolution:                                        |    Keywords:  review  
  Blocking:  10, 149                               |   Blockedby:          
---------------------------------------------------+------------------------

Comment(by slavazanko):

 BTW:
 {{{
 diff --git a/src/complete.c b/src/complete.c
 index a11b9c9..cb18f42 100644
 --- a/src/complete.c
 +++ b/src/complete.c
 @@ -944,7 +944,9 @@ complete_engine (WInput *in, int what_to_do)
             WListbox *query_list;

             for (p=in->completions + 1; *p; count++, p++) {
 -           *p = escape_string(*p);
 +               q = escape_string(*p);
 +               g_free(*p);
 +               *p = q;
                 if ((i = strlen (*p)) > maxlen)
                     maxlen = i;
                         }
 }}}

 I think, this remove some memory leaks...

 And need to review some other parts in patch. For example src/file.c:1876

 {{{
 source_with_path = unescape_string(source_with_path);
 }}}
 I think, in any case need to free memory by old pointer. Example:
 {{{
 char *old_pnt;

 ...
 old_pnt = source_with_path;
 source_with_path = unescape_string(source_with_path);
 g_free(old_pnt);
 }}}
 and others like this...

-- 
Ticket URL: <www.midnight-commander.org/ticket/147#comment:12>
Midnight Commander <www.midnight-commander.org>
Midnight Development Center


More information about the mc-devel mailing list