From 7bc85b239746b64c94eebad8e3917da328d71702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Bohner=20=28xzvf=29?= Date: Thu, 7 Jul 2022 15:19:56 +0200 Subject: [PATCH] Coalesce cleanup in ffParsePropFileValues --- src/common/properties.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/common/properties.c b/src/common/properties.c index de39be817..df9a7b60c 100644 --- a/src/common/properties.c +++ b/src/common/properties.c @@ -92,6 +92,8 @@ bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer) bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries) { + bool returnValue = true; + bool valueStorage[4]; bool* unsetValues; @@ -108,19 +110,10 @@ bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquer } FILE* file = fopen(filename, "r"); - if(file == NULL) + if(file == NULL || allSet) { - if(unsetValues != valueStorage) - free(unsetValues); - return false; - } - - if(allSet) - { - fclose(file); - if(unsetValues != valueStorage) - free(unsetValues); - return true; + returnValue = allSet; + goto cleanup; } char* line = NULL; @@ -143,12 +136,13 @@ bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquer if(line != NULL) free(line); - fclose(file); - +cleanup: + if(file != NULL) + fclose(file); if(unsetValues != valueStorage) free(unsetValues); - return true; + return returnValue; } bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer)