Skip to content

Commit a08ece9

Browse files
authored
Initialize uninitialized pointer and scalar members in QUIC and tscpp classes (#13023)
Add default member initializers for pointer, scalar, and enum members that Coverity flagged as uninitialized: - QUICStreamError::stream (nullptr) - QUICSentPacketInfo: packet_number, ack_eliciting, in_flight, sent_bytes, time_sent, type, pn_space - QUICSentPacketInfo::FrameInfo::_generator (nullptr) - QUICTransferProgressProviderSA::_adapter (nullptr) - InterceptPlugin::state_ (nullptr) - AsyncTimer::state_ (nullptr)
1 parent 33800d2 commit a08ece9

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

include/iocore/net/quic/QUICTransferProgressProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class QUICTransferProgressProviderSA : public QUICTransferProgressProvider
5454
bool is_cancelled() const override;
5555

5656
private:
57-
QUICStreamAdapter *_adapter;
57+
QUICStreamAdapter *_adapter{nullptr};
5858
};
5959

6060
class QUICTransferProgressProviderVIO : public QUICTransferProgressProvider

include/iocore/net/quic/QUICTypes.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class QUICStreamError : public QUICError
214214
QUICStreamError(const QUICStream *s, const QUICAppErrorCode error_code, const char *error_msg = nullptr)
215215
: QUICError(QUICErrorClass::APPLICATION, static_cast<uint16_t>(error_code), error_msg), stream(s){};
216216

217-
const QUICStream *stream;
217+
const QUICStream *stream{nullptr};
218218
};
219219

220220
using QUICErrorUPtr = std::unique_ptr<QUICError>;
@@ -575,20 +575,20 @@ struct QUICSentPacketInfo {
575575

576576
private:
577577
QUICFrameId _id = 0;
578-
QUICFrameGenerator *_generator;
578+
QUICFrameGenerator *_generator{nullptr};
579579
};
580580

581581
// Recovery A.1.1. Sent Packet Fields
582-
QUICPacketNumber packet_number;
583-
bool ack_eliciting;
584-
bool in_flight;
585-
size_t sent_bytes;
586-
ink_hrtime time_sent;
582+
QUICPacketNumber packet_number{0};
583+
bool ack_eliciting{false};
584+
bool in_flight{false};
585+
size_t sent_bytes{0};
586+
ink_hrtime time_sent{0};
587587

588588
// Additional fields
589-
QUICPacketType type;
589+
QUICPacketType type{QUICPacketType::UNINITIALIZED};
590590
std::vector<FrameInfo> frames;
591-
QUICPacketNumberSpace pn_space;
591+
QUICPacketNumberSpace pn_space{QUICPacketNumberSpace::INITIAL};
592592
// End of additional fields
593593
};
594594

include/tscpp/api/AsyncTimer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class AsyncTimer : public AsyncProvider
8686
void cancel() override;
8787

8888
private:
89-
AsyncTimerState *state_;
89+
AsyncTimerState *state_{nullptr};
9090
};
9191

9292
} // namespace atscppapi

include/tscpp/api/InterceptPlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class InterceptPlugin : public TransactionPlugin
9696
bool setOutputComplete();
9797

9898
private:
99-
State *state_;
99+
State *state_{nullptr};
100100

101101
bool doRead();
102102
void handleEvent(int, void *);

0 commit comments

Comments
 (0)