From: Ben Pfaff Date: Tue, 2 Feb 2010 22:03:36 +0000 (-0800) Subject: stp: Fix memory leak. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=896eec37b2952219a27c7f747931a2fcdab2ac3e;p=openvswitch stp: Fix memory leak. Found with valgrind. --- diff --git a/lib/stp.c b/lib/stp.c index cf1b2f98..6fad3a08 100644 --- a/lib/stp.c +++ b/lib/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. @@ -256,7 +256,10 @@ stp_create(const char *name, stp_identifier bridge_id, void stp_destroy(struct stp *stp) { - free(stp); + if (stp) { + free(stp->name); + free(stp); + } } /* Runs 'stp' given that 'ms' milliseconds have passed. */