On request from Albert Chin:
[metze/wireshark/wip.git] / tap-radiusstat.c
index 2d6a3fc9d69a7852d4530bdc397d8eee912c0e78..278e62a05fc3c73dd6096d39bc407c68dbffe854 100644 (file)
@@ -54,12 +54,12 @@ typedef struct _radiusstat_t {
 } radiusstat_t;
 
 static const value_string radius_message_code[] = {
-  {  0,        "Overall       "},
-  {  1,        "Access        "},
-  {  2,        "Accounting    "},
-  {  3,        "Access Passw  "},
+  {  0, "Overall       "},
+  {  1, "Access        "},
+  {  2, "Accounting    "},
+  {  3, "Access Passw  "},
   {  4, "Ascend Acce Ev"},
-  {  5, "Diconnect     "},
+  {  5, "Disconnect    "},
   {  6, "Change Filter "},
   {  7, "Other         "},
   {  0, NULL}
@@ -170,18 +170,15 @@ radiusstat_init(const char *optarg, void* userdata _U_)
 {
        radiusstat_t *rs;
        int i;
-       const char *filter=NULL;
        GString *error_string;
 
+       rs=g_malloc(sizeof(radiusstat_t));
        if(!strncmp(optarg,"radius,rtd,",11)){
-               filter=optarg+11;
+               rs->filter=g_strdup(optarg+11);
        } else {
-               filter="";
+               rs->filter=NULL;
        }
 
-       rs=g_malloc(sizeof(radiusstat_t));
-       rs->filter=g_strdup(filter);
-
        for(i=0;i<NUM_TIMESTATS;i++) {
                rs->rtd[i].num=0;
                rs->rtd[i].min_num=0;
@@ -199,7 +196,7 @@ radiusstat_init(const char *optarg, void* userdata _U_)
        rs->req_dup_num=0;
        rs->rsp_dup_num=0;
 
-       error_string=register_tap_listener("radius", rs, filter, NULL, radiusstat_packet, radiusstat_draw);
+       error_string=register_tap_listener("radius", rs, rs->filter, 0, NULL, radiusstat_packet, radiusstat_draw);
        if(error_string){
                /* error, we failed to attach to the tap. clean up */
                g_free(rs->filter);