Change in osmo-hlr[master]: db: Avoid use uninitialized rc if running 0 statements

pespin gerrit-no-reply at lists.osmocom.org
Thu Jul 15 11:33:48 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/24951 )


Change subject: db: Avoid use uninitialized rc if running 0 statements
......................................................................

db: Avoid use uninitialized rc if running 0 statements

Caught by new gcc 11.1.0:
/git/osmo-hlr/src/db.c:257:16: error: ‘rc’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  257 |         return rc;
      |                ^~

Change-Id: I45e1fede234cd4446a7061fb908bf344eee72f5a
---
M src/db.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/51/24951/1

diff --git a/src/db.c b/src/db.c
index 3a7cf49..4fd2654 100644
--- a/src/db.c
+++ b/src/db.c
@@ -234,7 +234,7 @@
 
 static int db_run_statements(struct db_context *dbc, const char **statements, size_t statements_count)
 {
-	int rc;
+	int rc = 0;
 	int i;
 	for (i = 0; i < statements_count; i++) {
 		const char *stmt_str = statements[i];

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/24951
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I45e1fede234cd4446a7061fb908bf344eee72f5a
Gerrit-Change-Number: 24951
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210715/656c4503/attachment.htm>


More information about the gerrit-log mailing list