From d1ae8fa17d8316adc50f83b249e3dbb56a7c55a3 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Thu, 21 May 2015 01:23:47 +0200 Subject: [PATCH] Properly traverse list --- src/cfg_decoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cfg_decoder.c b/src/cfg_decoder.c index 5f4c003..daf2805 100644 --- a/src/cfg_decoder.c +++ b/src/cfg_decoder.c @@ -140,7 +140,8 @@ cfg_decoder_add_match(struct cfg_decoder *d, const char *ext, d2 = cfg_decoder_find(ext); e = NULL; if (d2) { - while (NULL != (e2 = TAILQ_FIRST(&d2->exts))) { + e2 = TAILQ_FIRST(&d2->exts); + while (e2) { if (0 == strcasecmp(e2->ext, ext)) { log_notice("%s: relocating match from %s to %s", ext, d2->name, d->name); @@ -148,6 +149,7 @@ cfg_decoder_add_match(struct cfg_decoder *d, const char *ext, e = e2; break; } + e2 = TAILQ_NEXT(e2, entry); } } if (!e) {