From: Michael Tremer Date: Tue, 22 Oct 2024 14:26:41 +0000 (+0000) Subject: libpakfire: Initialize some return values that could be undefined X-Git-Tag: 0.9.30~960 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1bc07f07f0dec2531428cfacfa53d706406c079;p=pakfire.git libpakfire: Initialize some return values that could be undefined Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/config.c b/src/libpakfire/config.c index 7c1b61117..1c0b449e7 100644 --- a/src/libpakfire/config.c +++ b/src/libpakfire/config.c @@ -424,7 +424,7 @@ int pakfire_config_has_section(struct pakfire_config* config, const char* name) int pakfire_config_read(struct pakfire_config* config, FILE* f) { char section[SECTION_MAX_LENGTH] = ""; char key[KEY_MAX_LENGTH] = ""; - int r; + int r = -EINVAL; char* line = NULL; size_t l = 0; diff --git a/src/libpakfire/file.c b/src/libpakfire/file.c index 7dbde5b30..41af11cfb 100644 --- a/src/libpakfire/file.c +++ b/src/libpakfire/file.c @@ -1883,7 +1883,7 @@ static int pakfire_file_for_elf_section(struct pakfire_file* file, Elf_Scn* section = NULL; GElf_Shdr shdr; Elf_Data* data; - int r; + int r = -EINVAL; // Walk through all sections for (;;) { diff --git a/src/libpakfire/key.c b/src/libpakfire/key.c index b12778f80..c1f6cf9c5 100644 --- a/src/libpakfire/key.c +++ b/src/libpakfire/key.c @@ -951,7 +951,7 @@ static int pakfire_key_read_signature(struct pakfire_key* key, struct pakfire_key_signature* signature, FILE* f) { void* buffer = NULL; size_t buffer_length = 0; - int r; + int r = -EINVAL; char* line = NULL; size_t length = 0; diff --git a/src/libpakfire/progress.c b/src/libpakfire/progress.c index f1d1c6bb9..df62beff8 100644 --- a/src/libpakfire/progress.c +++ b/src/libpakfire/progress.c @@ -248,7 +248,7 @@ int pakfire_progress_finish(struct pakfire_progress* p) { } int pakfire_progress_update(struct pakfire_progress* p, unsigned long int value) { - int r; + int r = -EINVAL; // Report the change to the parent progress if (p->parent) {