X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Ftest-stp.c;h=83d571defd046a983576daad4fde95869a986289;hb=10df718e73122df2f3b04ed585e50e4b299a8cbd;hp=ce9decc8d87b2fbb4ffecc96aa017ba4da11e187;hpb=bc5ef83d2f042b1a1336d38e32d4893e47c7afcc;p=openvswitch diff --git a/tests/test-stp.c b/tests/test-stp.c index ce9decc8..83d571de 100644 --- a/tests/test-stp.c +++ b/tests/test-stp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "stp.h" #include #include @@ -301,6 +303,7 @@ simulate(struct test_case *tc, int granularity) struct bpdu *bpdu = &b->rxq[b->rxq_tail % RXQ_SIZE]; stp_received_bpdu(stp_get_port(b->stp, bpdu->port_no), bpdu->data, bpdu->size); + free(bpdu->data); any = true; } } @@ -357,6 +360,7 @@ get_token(void) pos++; } if (*pos == '\0') { + free(token); token = NULL; return false; } @@ -644,6 +648,19 @@ main(int argc, char *argv[]) err("trailing garbage on line"); } } + free(token); + + for (i = 0; i < tc->n_lans; i++) { + struct lan *lan = tc->lans[i]; + free((char *) lan->name); + free(lan); + } + for (i = 0; i < tc->n_bridges; i++) { + struct bridge *bridge = tc->bridges[i]; + stp_destroy(bridge->stp); + free(bridge); + } + free(tc); return 0; }