tbf: Use explicit initialisations in constructor (Coverity)

Currently when allocating tbf_alloc_ul_tbf or tbf_alloc_dl_tbf
objects, the allocated memory area is pre-initialised by talloc_zero
before the C++ constructors are called. This is not recognised by
Coverity, since there is no talloc model file yet. Thus Coverity
complains about missing initialisers.

On the other hand, it is still planned to convert the TBF classes
into real C++ ones. So instead of silencing Coverity directly, this
is an opportunity to do it the C++ way.

This commit adds initialisers and initialisation code for all
members that relied on talloc_zero. The corresponding calls to
talloc_zero are replaced by calls to talloc to give ASAN/valgrind
a chance to detect future initialisation errors. Some initialisation
code is also moved from setup_tbf to the constructors, notably the
initialisation of the bts pointer.

Fixes: Coverity CID 1320604, 1320605, 1320606

Sponsored-by: On-Waves ehf
diff --git a/src/tbf.h b/src/tbf.h
index 4a92bbf..b35ea78 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -111,7 +111,7 @@
 		     prefetch(pos->member.list.next))
 
 struct gprs_rlcmac_tbf {
-	gprs_rlcmac_tbf(gprs_rlcmac_tbf_direction dir);
+	gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir);
 
 	static void free_all(struct gprs_rlcmac_trx *trx);
 	static void free_all(struct gprs_rlcmac_pdch *pdch);
@@ -200,10 +200,12 @@
 	unsigned int fT; /* fTxxxx number */
 	unsigned int num_fT_exp; /* number of consecutive fT expirations */
 
-	struct {
+	struct Meas {
 		struct timeval rssi_tv; /* timestamp for rssi calculation */
 		int32_t rssi_sum; /* sum of rssi values */
 		int rssi_num; /* number of rssi values added since rssi_tv */
+
+		Meas();
 	} meas;
 
 	/* these should become protected but only after gprs_rlcmac_data.c
@@ -313,7 +315,7 @@
 }
 
 struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
-	gprs_rlcmac_dl_tbf();
+	gprs_rlcmac_dl_tbf(BTS *bts);
 
 	void cleanup();
 
@@ -355,13 +357,15 @@
 	int32_t m_last_dl_poll_fn;
 	int32_t m_last_dl_drained_fn;
 
-	struct {
+	struct BandWidth {
 		struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
 		uint32_t dl_bw_octets; /* number of octets since bw_tv */
 
 		struct timeval dl_loss_tv; /* timestamp for loss calculation */
 		uint16_t dl_loss_lost; /* sum of lost packets */
 		uint16_t dl_loss_received; /* sum of received packets */
+
+		BandWidth();
 	} m_bw;
 
 protected:
@@ -380,7 +384,7 @@
 };
 
 struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
-	gprs_rlcmac_ul_tbf();
+	gprs_rlcmac_ul_tbf(BTS *bts);
 
 	struct msgb *create_ul_ack(uint32_t fn);