Commit cadd186f authored by Max Kellermann's avatar Max Kellermann

output/jack: use AtScopeExit()

parent dd9ab16d
......@@ -22,6 +22,7 @@
#include "../OutputAPI.hxx"
#include "../Wrapper.hxx"
#include "config/ConfigError.hxx"
#include "util/ScopeExit.hxx"
#include "util/ConstBuffer.hxx"
#include "util/IterableSplitString.hxx"
#include "util/Error.hxx"
......@@ -557,6 +558,8 @@ JackOutput::Start(Error &error)
jports = nullptr;
}
AtScopeExit(jports) { free(jports); };
assert(num_dports > 0);
const char *duplicate_port = nullptr;
......@@ -584,10 +587,6 @@ JackOutput::Start(Error &error)
if (ret != 0) {
error.Format(jack_output_domain,
"Not a valid JACK port: %s", dports[i]);
if (jports != nullptr)
free(jports);
Stop();
return false;
}
......@@ -604,18 +603,11 @@ JackOutput::Start(Error &error)
error.Format(jack_output_domain,
"Not a valid JACK port: %s",
duplicate_port);
if (jports != nullptr)
free(jports);
Stop();
return false;
}
}
if (jports != nullptr)
free(jports);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment