Skip to content

Commit dc102f7

Browse files
committed
aplay/jack: print help early
to avoid a leak as pointed by CID 472111
1 parent 3daae72 commit dc102f7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/audio/playback/jack.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ audio_play_jack_init(const struct audio_playback_opts *opts)
162162
const char *source_name = "";
163163

164164
snprintf_ch(client_name, "%s", PACKAGE_NAME);
165+
if (strcmp(opts->cfg, "help") == 0) {
166+
audio_play_jack_help(client_name);
167+
return INIT_NOERR;
168+
}
165169

166170
struct state_jack_playback *s = calloc(1, sizeof(*s));
167171
if(!s) {
@@ -179,11 +183,6 @@ audio_play_jack_init(const struct audio_playback_opts *opts)
179183
snprintf_ch(dup, "%s", opts->cfg);
180184
char *tmp = dup, *item, *save_ptr;
181185
while ((item = strtok_r(tmp, ":", &save_ptr)) != NULL) {
182-
if (strcmp(item, "help") == 0) {
183-
audio_play_jack_help(client_name);
184-
free(s);
185-
return INIT_NOERR;
186-
}
187186
if (strstr(item, "first_channel=") == item) {
188187
char *endptr;
189188
char *val = item + strlen("first_channel=");

0 commit comments

Comments
 (0)