Merge pull request #126 from mer-hybris/jb61912

Eliminate defects found by Coverity
This commit is contained in:
Slava Monich
2024-04-12 04:51:00 +03:00
committed by GitHub
3 changed files with 25 additions and 20 deletions

8
misc/coverity_model.c Normal file
View File

@@ -0,0 +1,8 @@
typedef struct gbinder_remote_request GBinderRemoteRequest;
void
gbinder_remote_request_unref(
GBinderRemoteRequest* req)
{
__coverity_free__(req);
}

View File

@@ -1173,7 +1173,7 @@ gbinder_driver_free_buffer(
write.ptr = (uintptr_t)wbuf;
write.size = len;
write.consumed = 0;
gbinder_driver_write(self, &write);
(void) gbinder_driver_write(self, &write);
}
}

View File

@@ -905,28 +905,25 @@ gbinder_ipc_looper_check(
{
if (G_LIKELY(self)) {
GBinderIpcPriv* priv = self->priv;
GBinderIpcLooper* new_looper = NULL;
/* Lock */
g_mutex_lock(&priv->looper_mutex);
if (!priv->primary_loopers) {
GBinderIpcLooper* looper;
priv->primary_loopers = gbinder_ipc_looper_new(self);
new_looper = priv->primary_loopers;
if (new_looper) {
gbinder_ipc_looper_ref(new_looper);
}
}
g_mutex_unlock(&priv->looper_mutex);
/* Unlock */
/* Lock */
g_mutex_lock(&priv->looper_mutex);
if (!priv->primary_loopers) {
priv->primary_loopers = gbinder_ipc_looper_new(self);
}
looper = priv->primary_loopers;
if (looper) {
gbinder_ipc_looper_ref(looper);
}
g_mutex_unlock(&priv->looper_mutex);
/* Unlock */
/* We are not ready to accept incoming transactions until
* looper has started. We may need to wait a bit. */
if (looper) {
gbinder_ipc_looper_start(looper);
gbinder_ipc_looper_unref(looper);
}
/* We are not ready to accept incoming transactions until
* looper has started. We may need to wait a bit. */
if (new_looper) {
gbinder_ipc_looper_start(new_looper);
gbinder_ipc_looper_unref(new_looper);
}
}
}