From Harald Welte:
[obnox/wireshark/wip.git] / tap-h225counter.c
index bafc80ba327345dc881ce719808fe55a9f4b6cfd..6076f1c22534ff43a95d5389fd37eedc9755a354 100644 (file)
@@ -39,7 +39,6 @@
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
-#include "register.h"
 #include <epan/dissectors/packet-h225.h>
 
 /* following values represent the size of their valuestring arrays */
@@ -225,7 +224,6 @@ h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
 
        default:
                return 0;
-               break;
        }
 
        return 1;
@@ -307,6 +305,7 @@ h225counter_draw(void *phs)
                                                printf("    %s : %u\n", val_to_str(j,LocationRejectReason_vals,"unknown reason   "), hs->lrj_reason[j]);
                                        }
                                }
+                               break;
                        case 29: /* IRQNak */
                                for(j=0;j<=IRQNAK_REASONS;j++) {
                                        if(hs->irqnak_reason[j]!=0) {
@@ -353,21 +352,18 @@ static void
 h225counter_init(const char *optarg, void* userdata _U_)
 {
        h225counter_t *hs;
-       const char *filter=NULL;
        GString *error_string;
 
+       hs = g_malloc(sizeof(h225counter_t));
        if(!strncmp(optarg,"h225,counter,",13)){
-               filter=optarg+13;
+               hs->filter=g_strdup(optarg+13);
        } else {
-               filter="";
+               hs->filter=NULL;
        }
 
-       hs = g_malloc(sizeof(h225counter_t));
-       hs->filter=g_strdup(filter);
-
        h225counter_reset(hs);
 
-       error_string=register_tap_listener("h225", hs, filter, NULL, h225counter_packet, h225counter_draw);
+       error_string=register_tap_listener("h225", hs, hs->filter, 0, NULL, h225counter_packet, h225counter_draw);
        if(error_string){
                /* error, we failed to attach to the tap. clean up */
                g_free(hs->filter);