From: Ben Pfaff Date: Tue, 2 Feb 2010 22:03:36 +0000 (-0800) Subject: stp: Fix memory leak. X-Git-Tag: v1.0.0~259^2~201 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=896eec37b2952219a27c7f747931a2fcdab2ac3e;p=sliver-openvswitch.git stp: Fix memory leak. Found with valgrind. --- diff --git a/lib/stp.c b/lib/stp.c index cf1b2f981..6fad3a08e 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. */