(/home/sate/Testcases/c/cve/wireshark-1.2.0/tap-camelcounter.c) |
| |
| 95 | | | static void camelcounter_init(const char *optarg, void* userdata _U_) |
| 96 | | | { |
| 97 | | | struct camelcounter_t *p_camelcounter; |
| 98 | | | const char *filter=NULL; |
| 99 | | | const char *emptyfilter=""; |
| 100 | | | GString *error_string; |
| 101 | | | |
| 102 | | | if(!strncmp(optarg,"camel,counter,",13)){ |
| 103 | | | filter=optarg+13; |
| 104 | | | } else { |
| 105 | | | filter=NULL; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 106 | | | } |
| 107 | | | |
| 108 | | | p_camelcounter = g_malloc(sizeof(struct camelcounter_t)); |
| 109 | | | if(filter){ |
| 110 | | | p_camelcounter->filter=g_strdup(filter); |
| 111 | | | } else { |
| 112 | | | p_camelcounter->filter=NULL; |
| 113 | | | } |
| 114 | | | |
| 115 | | | camelcounter_reset(p_camelcounter); |
| 116 | | | |
| 117 | | | if (filter) { |
| 118 | | | error_string=register_tap_listener("CAMEL", |
| 119 | | | p_camelcounter, |
| 120 | | | filter, |
| 121 | | | NULL, |
| 122 | | | camelcounter_packet, |
| 123 | | | camelcounter_draw); |
| 124 | | | } else { |
| 125 | | | error_string=register_tap_listener("CAMEL", |
| 126 | | | p_camelcounter, |
| 127 | | | emptyfilter, |
| 128 | | | NULL, |
| 129 | | | camelcounter_packet, |
| 130 | | | camelcounter_draw); |
| 131 | | | } |
| 132 | | | |
| 133 | | | if(error_string){ |
| 134 | | | |
| 135 | | | g_free(p_camelcounter->filter); |
| 136 | | | g_free(p_camelcounter); |
| 137 | | | |
| 138 | | | fprintf(stderr, "tshark: Couldn't register camel,counter tap: %s\n", |
| 139 | | | error_string->str); |
| 140 | | | g_string_free(error_string, TRUE); |
| 141 | | | exit(1); |
| 142 | | | } |
| 143 | | | } |
| |