[sr-dev] git:master:e03244bd: janssonrpcc: fix build warning

Victor Seva linuxmaniac at torreviejawireless.org
Thu Dec 5 20:22:13 CET 2019


Module: kamailio
Branch: master
Commit: e03244bd5804045a0ea06fb1afbd2d8269855c19
URL: https://github.com/kamailio/kamailio/commit/e03244bd5804045a0ea06fb1afbd2d8269855c19

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2019-12-05T20:08:08+01:00

janssonrpcc: fix build warning

> In file included from janssonrpc_connect.c:41:
> ./janssonrpc.h:98:9: warning: variable 'res' is uninitialized when used here [-Wuninitialized]
>       return res;
>              ^~~
> ./janssonrpc.h:96:2: note: variable 'res' is declared here
>       str res;
>       ^
> ./janssonrpc.h:105:9: warning: variable 'res' is uninitialized when used here [-Wuninitialized]
>       return res;
>              ^~~
> ./janssonrpc.h:103:2: note: variable 'res' is declared here
>       str res;
>       ^
>
> 2 warnings generated.

---

Modified: src/modules/janssonrpcc/janssonrpc.h

---

Diff:  https://github.com/kamailio/kamailio/commit/e03244bd5804045a0ea06fb1afbd2d8269855c19.diff
Patch: https://github.com/kamailio/kamailio/commit/e03244bd5804045a0ea06fb1afbd2d8269855c19.patch

---

diff --git a/src/modules/janssonrpcc/janssonrpc.h b/src/modules/janssonrpcc/janssonrpc.h
index 3756c817e3..b76e13fbfe 100644
--- a/src/modules/janssonrpcc/janssonrpc.h
+++ b/src/modules/janssonrpcc/janssonrpc.h
@@ -93,14 +93,14 @@ extern const str null_str;
 
 static inline str pkg_strdup(str src)
 {
-	str res;
+	str res = STR_NULL;
 	pkg_str_dup(&src, &res);
 	return res;
 }
 
 static inline str shm_strdup(str src)
 {
-	str res;
+	str res = STR_NULL;
 	shm_str_dup(&src, &res);
 	return res;
 }




More information about the sr-dev mailing list