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
Fixes:
Unchecked return value from library (CHECKED_RETURN).
check_return: Calling fseek(fp, 9L, 0) without checking return value.
This library function may fail and return an error code.
Change-Id: Id7c861a7a78df72968e0755dca47d9a70e736332
Remove `uac_auth_f` from `RegistrationAgentFactory`,
not used.
Fixes:
Uninitialized pointer field (UNINIT_CTOR).
uninit_member: Non-static class member uac_auth_f
is not initialized in this constructor nor in any functions that it calls.
Change-Id: I3e8d0703d8bd7226369248bd87c1449f97e7ac6a
Fixes:
Untrusted allocation size (TAINTED_SCALAR)
tainted_data: Passing tainted expression chunk_size - 16U
to wav_dummyread, which uses it as an allocation size.
Change-Id: Ide2c65c1c6c440b4e5aeb610cbc813631b24a6a6
Fixes:
Unchecked return value from library (CHECKED_RETURN),
check_return: Calling fseek(fp, chunk_size, 1)
without checking return value.
This library function may fail and return an error code.
Change-Id: Ibbf984f66f9efd2fe516efc9ab431a19396fd718
Move determination of absolute expiry time up into insert_timer(), and
make the rest of the code operate on absolute time. Add an extra method
to directly support absolute time.
Change-Id: I0a8dd27d82fb69b5083a6cfab693bfb275738495
We can now move the timer methods specific to the wheeltimer into
private scope and designate the wheeltimer class as friend.
Change-Id: I2b6bda406ff78733f1909948ed14d18d44b6f3c6
Don't store the relative expiry duration in the timer object. Only store
the absolute value. Pass the relative expiry for a new timer as a method
argument when inserting the timer into the tree instead.
No functional/behavioural changes.
Change-Id: I24817b0ac5801a5addf05bf9155fcb31017f2f68
Move some of the timer arming logic out of the wheeltimer and into the
timer class, so that more members can be made private. No functional
changes.
Change-Id: I4f2a10b0a3d9c775ec6cb903c2b82f4aa3219349
There is no reason we cannot directly insert new timers or remove
existing timers from the list of timers without having to delegate it to
the worker thread.
Change-Id: I2e615af83f64ac7e5024d7905432823044afe252
... instead of manually maintaining a linked list.
Store an iterator in the timer object so that it can be directly removed
if needed.
Change-Id: I38f1fbcdc6fe1b36a8adef6a95f36f8902a4f729
Move the timer resolution from a global define to an instance variable.
Use a default of the previous value. Switch all expiry values from
resolution-based to microseconds, and use 64-bit ints for all values.
Changes
timer::arm_absolute(u_int32_t wall_clock)
to
timer::arm()
Change-Id: I431220f378b4a9d2bd0f047d091ee5c8b3b72bfc