From b65ae14ccf5c0dda72cb55ffb55383613efe522e Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 9 Aug 2013 14:48:46 +0000 Subject: [PATCH] Fix two more segfaults in error paths Patch credit: surabhi-mishra --- fluidsynth/src/midi/fluid_midi_router.c | 2 +- fluidsynth/src/utils/fluid_settings.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fluidsynth/src/midi/fluid_midi_router.c b/fluidsynth/src/midi/fluid_midi_router.c index a4a4d64d..9b914733 100644 --- a/fluidsynth/src/midi/fluid_midi_router.c +++ b/fluidsynth/src/midi/fluid_midi_router.c @@ -315,7 +315,7 @@ fluid_midi_router_add_rule (fluid_midi_router_t *router, fluid_midi_router_rule_ fluid_return_val_if_fail (router != NULL, FLUID_FAILED); fluid_return_val_if_fail (rule != NULL, FLUID_FAILED); - fluid_return_val_if_fail (type >= 0 && type <= FLUID_MIDI_ROUTER_RULE_COUNT, FLUID_FAILED); + fluid_return_val_if_fail (type >= 0 && type < FLUID_MIDI_ROUTER_RULE_COUNT, FLUID_FAILED); fluid_mutex_lock (router->rules_mutex); /* ++ lock */ diff --git a/fluidsynth/src/utils/fluid_settings.c b/fluidsynth/src/utils/fluid_settings.c index 688fd465..78725fbf 100644 --- a/fluidsynth/src/utils/fluid_settings.c +++ b/fluidsynth/src/utils/fluid_settings.c @@ -1487,10 +1487,10 @@ fluid_settings_option_concat (fluid_settings_t *settings, const char *name, newlist = fluid_list_sort (newlist, fluid_list_str_compare_func); str = FLUID_MALLOC (len); - str[0] = 0; if (str) { + str[0] = 0; for (p = newlist; p; p = p->next) { option = fluid_list_get (p);