[sr-dev] git:5.2:e377ec1f: db_berkeley: fix compilation warning
Victor Seva
linuxmaniac at torreviejawireless.org
Wed Nov 14 10:58:39 CET 2018
Module: kamailio
Branch: 5.2
Commit: e377ec1fb2ce841b0b96c7f9c4cea935ad6f10f6
URL: https://github.com/kamailio/kamailio/commit/e377ec1fb2ce841b0b96c7f9c4cea935ad6f10f6
Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-11-14T10:58:17+01:00
db_berkeley: fix compilation warning
> CC (clang) [M db_berkeley.so] db_berkeley.o
> db_berkeley.c:916:5: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> db_berkeley.c:966:5: note: uninitialized use occurs here
> if(dbcp)
> ^~~~
> db_berkeley.c:916:2: note: remove the 'if' if its condition is always false
> if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> db_berkeley.c:901:6: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if(!lkey) {
> ^~~~~
> db_berkeley.c:966:5: note: uninitialized use occurs here
> if(dbcp)
> ^~~~
> db_berkeley.c:901:3: note: remove the 'if' if its condition is always false
> if(!lkey) {
> ^~~~~~~~~~~
> db_berkeley.c:875:11: note: initialize the variable 'dbcp' to silence this warning
> DBC *dbcp;
> ^
> = NULL
> 2 warnings generated.
(cherry picked from commit 93e0b7e7bcefa900e8686e7e60f1a59cc32f9b39)
---
Modified: src/modules/db_berkeley/db_berkeley.c
---
Diff: https://github.com/kamailio/kamailio/commit/e377ec1fb2ce841b0b96c7f9c4cea935ad6f10f6.diff
Patch: https://github.com/kamailio/kamailio/commit/e377ec1fb2ce841b0b96c7f9c4cea935ad6f10f6.patch
---
diff --git a/src/modules/db_berkeley/db_berkeley.c b/src/modules/db_berkeley/db_berkeley.c
index c3ea90fc16..80c9aefac0 100644
--- a/src/modules/db_berkeley/db_berkeley.c
+++ b/src/modules/db_berkeley/db_berkeley.c
@@ -872,7 +872,7 @@ int _bdb_delete_cursor(
int ret, klen = MAX_ROW_SIZE;
DBT key, data;
DB *db;
- DBC *dbcp;
+ DBC *dbcp = NULL;
int *lkey = NULL;
ret = 0;
More information about the sr-dev
mailing list