X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fmemory.c;h=6c97e190a7e12408da88b35e74e2e2625c067a15;hb=e379e4d167e31d1cd5f7b86fff091a2e09ff6e45;hp=779860ebc93ce573d16c753b5184844347fb0580;hpb=0d085684619be0baef309957a3d7410a23cb5f27;p=sliver-openvswitch.git diff --git a/lib/memory.c b/lib/memory.c index 779860ebc..6c97e190a 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Nicira, Inc. + * Copyright (c) 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,10 @@ static void memory_init(void); /* Runs the memory monitor. * - * The client should call memory_should_report() afterward. */ + * The client should call memory_should_report() afterward. + * + * This function, and the remainder of this module's interface, should be + * called from only a single thread. */ void memory_run(void) { @@ -119,6 +122,7 @@ compose_report(const struct simap *usage, struct ds *s) ds_put_format(s, "%s:%u ", node->name, node->data); } ds_chomp(s, ' '); + free(nodes); } /* Logs the contents of 'usage', as a collection of name-count pairs. @@ -137,7 +141,9 @@ memory_report(const struct simap *usage) compose_report(usage, &s); if (want_report) { - VLOG_INFO("%s", ds_cstr(&s)); + if (s.length) { + VLOG_INFO("%s", ds_cstr(&s)); + } want_report = false; } if (n_conns) {