components/iftop/patches/07.cfgfile.c.patch
branchs11-update
changeset 2968 3f4acbcf337b
equal deleted inserted replaced
2967:4f3c932b6bc8 2968:3f4acbcf337b
       
     1 This patch fixed segfault when supplying multiple options like '-f' for iftop.
       
     2 The fixing has been integrated into open iftop-1.0 pre-release version. We can
       
     3 see the fixing log here: 
       
     4 http://www.ex-parrot.com/~pdw/iftop/cvs/iftop/ChangeLog
       
     5 
       
     6 --- cfgfile.c.orig	2013-12-02 00:37:09.851645000 -0800
       
     7 +++ cfgfile.c	2013-12-02 00:31:53.734822000 -0800
       
     8 @@ -230,8 +230,13 @@
       
     9      stringmap S;
       
    10  
       
    11      S = stringmap_find(config, directive);
       
    12 -    if (S) stringmap_delete_free(S);
       
    13 -    stringmap_insert(config, directive, item_ptr(xstrdup(s)));
       
    14 +    if (S) {
       
    15 +	xfree(S->d.v);
       
    16 +	S->d = item_ptr(xstrdup(s));
       
    17 +    }
       
    18 +    else {
       
    19 +	stringmap_insert(config, directive, item_ptr(xstrdup(s)));
       
    20 +    }
       
    21  }
       
    22  
       
    23  int read_config(char *file, int whinge_on_error) {