Module Name:    src
Committed By:   christos
Date:           Tue Jan 12 19:40:50 UTC 2010

Modified Files:
        src/lib/libedit: eln.c

Log Message:
- call the mapping function directly instead of el_wset().
- save the strings passed to the mapping function so that they don't get
  re-used. This leaks. To fix it properly we could either pass a flag to
  free particular entries before re-using, or allocate all of them.
  Allocating all of them wastes memory, allocating some of them makes
  the code more complex.
This fixes compatibility binding (shell tab completion for example)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libedit/eln.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/eln.c
diff -u src/lib/libedit/eln.c:1.3 src/lib/libedit/eln.c:1.4
--- src/lib/libedit/eln.c:1.3	Thu Dec 31 10:58:26 2009
+++ src/lib/libedit/eln.c	Tue Jan 12 14:40:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: eln.c,v 1.3 2009/12/31 15:58:26 christos Exp $	*/
+/*	$NetBSD: eln.c,v 1.4 2010/01/12 19:40:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.3 2009/12/31 15:58:26 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.4 2010/01/12 19:40:50 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include "histedit.h"
@@ -191,7 +191,9 @@
 		    ret = -1;
 		    goto out;
 		}
-		ret = el_wset(el, op, wargv[0], wargv[1], func);
+		// XXX: The two strdup's leak
+		ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
+		    func);
 		ct_free_argv(wargv);
 		break;
 	}

Reply via email to