The branch, master has been updated
       via  939f796f086cac17ad0558b36fa87c55a9cb1a22 (commit)
      from  27364345bf68785af58131c47ef46ff081622537 (commit)

- Log -----------------------------------------------------------------
commit 939f796f086cac17ad0558b36fa87c55a9cb1a22
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Don't leak formats if they are added multiple times.
---
 format.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/format.c b/format.c
index 16ac53d..2275090 100644
--- a/format.c
+++ b/format.c
@@ -151,6 +151,7 @@ void
 format_add(struct format_tree *ft, const char *key, const char *fmt, ...)
 {
        struct format_entry     *fe;
+       struct format_entry     *fe_now;
        va_list                  ap;
 
        fe = xmalloc(sizeof *fe);
@@ -160,7 +161,13 @@ format_add(struct format_tree *ft, const char *key, const 
char *fmt, ...)
        xvasprintf(&fe->value, fmt, ap);
        va_end(ap);
 
-       RB_INSERT(format_tree, ft, fe);
+       fe_now = RB_INSERT(format_tree, ft, fe);
+       if (fe_now != NULL) {
+               free(fe_now->value);
+               fe_now->value = fe->value;
+               free(fe->key);
+               free(fe);
+       }
 }
 
 /* Find a format entry. */


-----------------------------------------------------------------------

Summary of changes:
 format.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to