read() and write() return ssize_t. Update variables and other affected
class members. Pointer arithmetic also returns ssize_t.
Fixes a potential overflow.
Change-Id: I411ad648777fdba5c0fd59f9f7721a2971b60e1d
Warned-by: Coverity
Use overloading for the various flavours of str2int functions. This has
the benefit of automatically choosing the appropriate function for
aliased types that may be one or the other underlying type, such as
size_t.
Do a mass renaming of all relevant instances.
Change-Id: I7abb6b9031ee53332d2b04a6cba4a6cc667a4807
Initialize `from_addr` just setting it all to zero.
Fixes:
*** CID 545189: Uninitialized members (UNINIT_CTOR)
/core/sip/udp_trsp.cpp: 265 in udp_trsp::udp_trsp(udp_trsp_socket *)()
259 msg.msg_name = &from_addr;
260 msg.msg_namelen = sizeof(sockaddr_storage);
261 msg.msg_iov = iov;
262 msg.msg_iovlen = 1;
263 msg.msg_control = dst_addr_buf;
264 msg.msg_controllen = DSTADDR_DATASIZE;
>>> CID 545189: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "from_addr.__ss_align" is not initialized in this constructor nor in any functions that it calls.
265 }
266
267 udp_trsp::~udp_trsp()
268 {
269 }
270
Change-Id: I7f960e6b41c6d7dfec4f70a91d0e7b37f7675127
Properly handle in the second `setRegistrationTimer`'s
overloading, wheread peerings used to not get
an insertion of timer into own dedicated map.
Change-Id: Ib793ed6a6eb13447d27321eab59957d1bec2aabf
Don't re-use a stupid code to check the type each
time it needs to printed somewhere in logs.
Just use the macro function to handle this job.
Change-Id: I942f4f3b0730fa3c66ce6df10e0e1ff109e09bd5
Don't use std::string, because all multiple
conditions based on that in the code, make code
comparisons quite heavy in comparison to enum usage.
So just use enum type with default `TYPE_UNDEFINED`.
Refactor code accordingly and remove superfluous
code that now isn't required.
Change-Id: Icf29579cd3b93a1624854bd0a47610fc061c64e6
Before to actually do any work based on that
we have to check if it actually dereferences anything
reasonable.
Change-Id: I736b7f44c9702ac49fbab967f6baea2be5279d74
Just refactoring, no func changes.
Fixes things like:
*** CID 545192: Uninitialized members (UNINIT_CTOR)
/apps/db_reg_agent/DBRegAgent.cpp: 73 in RegTimer::RegTimer()()
67 }
68
69 long object_id = 0;
70 RegistrationActionEvent::RegAction action;
71 string type;
72
>>> CID 545192: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "action" is not initialized in this constructor nor in any functions that it calls.
73 RegTimer() {}
74 };
75
76 DBRegAgent::DBRegAgent(const string& _app_name)
77 : AmDynInvokeFactory(_app_name),
78 AmEventQueue(this),
Change-Id: If7fdf53918e711a6b3d262f496ab0e0a349da4b8
No need to always check for:
`type == TYPE_SUBSCRIBER || type == TYPE_UNDEFINED`
The type is either `TYPE_PEERING` or the rest
(subscriber, or if CSTA didn't point out the type
explicitly it's undefined, but then again it's
related to subscriber's type).
Refactor the code accordingly. No func changes.
Change-Id: I5f045b645c971ef309436a5d1c3a4dbc7f180045
Just in case some user still needs the object
to be used through the code later.
E.g.: DBRegAgent module.
Change-Id: Iacd9104edfe757cf475ab25192411103124ed98b
AmThread::stop() detaches the thread, which makes it impossible to
::join() it. Only call one or the other.
Change-Id: Icc9301dc9b31856ec7f963835cffd315bbc925bb
Fixes:
Uninitialized pointer field (UNINIT_CTOR)
Non-static class member current_diag is not initialized
in this constructor nor in any functions that it calls.
Change-Id: I80fd5175edb68079e7b7da7a336bcc7f0e882016
dynamic_cast is used for safe downcasting, so it makes
sense to always ensure whether this cast fails and returns
a null pointer.
Fixes an amount of cases reported by Coverity Scan, alike:
Dynamic cast to pointer dynamic_cast <sip_cseq *>(t->msg->cseq->p) can return NULL.
Assigning: t_cseq = dynamic_cast <sip_cseq *>(t->msg->cseq->p).
Unchecked dynamic_cast (FORWARD_NULL)
Dereferencing null pointer t_cseq.
Change-Id: I5f9bd1a316603ad88b3fdcb2425b4fe8bf99e6a8
Use smart pointers instead of handling with new/delete.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable rev going out of scope leaks the storage it points to.
Change-Id: I33dfe6c4a74a01774093dc500248c3ed613b5710
Do the dummy read in pieces of 4096. This eliminates the need for a
heap-allocated buffer, which in turn eliminates a possible mem leak.
Change-Id: Ibbbd6f2ef1fa315fad94715c65a74426b3448862
Warned-by: Coverity
Turn objects used by recvmsg() into class members. Eliminates having to
re-initialise them each time.
Change-Id: I9acb6f5f6460c5a9f4c7fb41f8a9e517c7cbbf8b
Warned-by: Coverity
Add cast to make it clear that this is an intentional truncation of a
time_t to an int.
Change-Id: I676f7eb30d4016a531e94975fb230c2d7c9aa9f7
Warned-by: Coverity
When handling `XMLRPC2DIServer` allocation,
first make sure to have the `XmlRpcServer`
and then do rest of processing (e.g.: `di_export`,
`di_method`, `registerMethods()` etc.)
Otherwise can lead to seg.faults when appealing
to objects via still non-allocated `XmlRpcServer`
object.
Change-Id: Id3395ce3e0d6f2de76ed8caa1a786a6e139a851b
There is no need for a generic timer callback option without good
typing, as we can just subclass the timer class and use our own fire()
method and whatever other class members are needed.
Change-Id: I95cd60277b5b4d3f492389958fa7f2ead921479e
If the dlg object is freed, then don't try to log
things based on the call-id value taken from it.
Just do slightly before.
Change-Id: I09e865ca77d64c6c398cf8dc35c189e076fdb26d
For the `XMLRPC2DIServer` class as well as for the
`XMLRPC2DI` one, heap allocated objects aren't properly
managed by destruction time.
Pointers have to be initialized as NULL, and point
only when allocation was successfull.
Then by a destruction time, check them and free.
Change-Id: I1a31813db254cc4ab0f7ecc7b382fcb3635feee0
There is only one instance of XMLRPC2DI API,
hence only one possible value for a list of
class members, such as:
- XML RPC port for DI
- XML RPC DI server
- variable, which defines, if that's configured
Additionally fixes:
Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member XMLRPCPort
is not initialized in this constructor nor in any functions that it calls.
Change-Id: I0120652220129774137e90d1ad8dfa579cca3202
It has no sense to keep it as `unsigned int`, because
it's used in comparisons with other `time_t` type
variables.
Although it's only used for now in `is_active()`.
Change-Id: Iceda2338d88ba7de38d084001bbfce03da75e452
No need to cast them into `unsigned int`,
especially using the C-style casting.
Fixes:
Use of 32-bit time_t (Y2K38_SAFETY)
store_truncates_time_t: A time_t value is stored in an integer
with too few bits to accommodate it.
The expression time(NULL) is cast to unsigned int.
Change-Id: I0b7ecb86d4941d4441c8e89ade589064693c226e
Use only references to pass parameters to constructor,
otherwise copy operation would be used instead of move.
Same for other class methods.
Fixes:
Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE)
copy_constructor_call: direct_export is passed-by-value as parameter
to std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const &),
when it could be moved instead.
...
Change-Id: If4be730292b3329af1d806c8cf8292498428ea61
Fix possible memory leak during loading.
No functional change.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable s going
out of scope leaks the storage it points to.
Change-Id: Ibed584c7ce82056bf0d4c492d76b78584eb7ac08
Fixes:
Division or modulo by float zero (DIVIDE_BY_ZERO).
divide_by_zero: In function call resampleOutput,
division by expression mixer_sample_rate which may be zero has undefined behavior.
Change-Id: I7f7b8738eb643499dfbf5e830f3904c62ed02b45
Fixes:
cond_cannot_single: Condition output_sample_rate, taking true branch.
Now the value of output_sample_rate cannot be equal to 0.
cannot_single: At condition output_sample_rate,
the value of output_sample_rate cannot be equal to 0
Logically dead code (DEADCODE).
Change-Id: I629cb7fc50b8883a53e7f5cf8d24bd2042b95154