From 856ab5815cc628e851f0e9f2beee8884ba12d0bf Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 3 Jul 2025 16:51:44 +0200 Subject: [PATCH] MT#61856 parse_attribute_crypto: initialize `err` at least to something MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: ../lib/loglib.h:54:17: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] 54 | __ilog(prio, "[%s] " fmt, log_level_names[system], ##__VA_ARGS__); \ | ^~~~~~ sdp.c:613:21: note: ‘err’ was declared here 613 | const char *err; | ^~~ sdp.c:734:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] 734 | ilog(LOG_ERROR, "Failed to parse a=crypto attribute, ignoring: %s", err); | ^ sdp.c:613:21: note: ‘err’ was declared here 613 | const char *err; | ^ Change-Id: I18c3c1d6f2d6d5643a61ef864116e1f3d5e1db95 --- daemon/sdp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 3f77339a6..a2f7f97c8 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -610,7 +610,7 @@ static int parse_attribute_crypto(struct sdp_attribute *output) { gsize ret; str s; uint32_t u32; - const char *err; + const char *err = NULL; output->attr = ATTR_CRYPTO; @@ -731,6 +731,8 @@ static int parse_attribute_crypto(struct sdp_attribute *output) { return 0; error: + if (!err) + err = "generic error"; ilog(LOG_ERROR, "Failed to parse a=crypto attribute, ignoring: %s", err); output->attr = ATTR_IGNORE; return -1;