(/home/sate/Testcases/c/cve/wireshark-1.2.0/tap-camelsrt.c) |
| |
| 211 | | | static void camelsrt_init(const char *optarg, void* userdata _U_) |
| 212 | | | { |
| 213 | | | struct camelsrt_t *p_camelsrt; |
| 214 | | | const char *filter=NULL; |
| 215 | | | const char *emptyfilter=""; |
| 216 | | | |
| 217 | | | GString *error_string; |
| 218 | | | |
| 219 | | | if(!strncmp(optarg,"camel,srt,",9)){ |
| 220 | | | filter=optarg+9; |
| 221 | | | } else { |
| 222 | | | filter=NULL; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 223 | | | } |
| 224 | | | |
| 225 | | | p_camelsrt = g_malloc(sizeof(struct camelsrt_t)); |
| 226 | | | if(filter){ |
| 227 | | | p_camelsrt->filter=g_strdup(filter); |
| 228 | | | } else { |
| 229 | | | p_camelsrt->filter=NULL; |
| 230 | | | } |
| 231 | | | camelsrt_reset(p_camelsrt); |
| 232 | | | |
| 233 | | | if (filter) { |
| 234 | | | error_string=register_tap_listener("CAMEL", |
| 235 | | | p_camelsrt, |
| 236 | | | filter, |
| 237 | | | NULL, |
| 238 | | | camelsrt_packet, |
| 239 | | | camelsrt_draw); |
| 240 | | | } else { |
| 241 | | | error_string=register_tap_listener("CAMEL", |
| 242 | | | p_camelsrt, |
| 243 | | | emptyfilter, |
| 244 | | | NULL, |
| 245 | | | camelsrt_packet, |
| 246 | | | camelsrt_draw); |
| 247 | | | } |
| 248 | | | |
| 249 | | | if(error_string){ |
| 250 | | | |
| 251 | | | g_free(p_camelsrt->filter); |
| 252 | | | g_free(p_camelsrt); |
| 253 | | | |
| 254 | | | fprintf(stderr, "tshark: Couldn't register camel,srt tap: %s\n", |
| 255 | | | error_string->str); |
| 256 | | | g_string_free(error_string, TRUE); |
| 257 | | | exit(1); |
| 258 | | | } |
| 259 | | | |
| 260 | | | |
| 261 | | | |
| 262 | | | |
| 263 | | | |
| 264 | | | |
| 265 | | | |
| 266 | | | gtcap_StatSRT=TRUE; |
| 267 | | | gcamel_StatSRT=TRUE; |
| 268 | | | } |
| |