]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: grpc: fix covevrity warnings 10804/head
authorChristian Hopps <chopps@labn.net>
Wed, 16 Mar 2022 14:11:19 +0000 (10:11 -0400)
committerChristian Hopps <chopps@labn.net>
Wed, 16 Mar 2022 15:31:50 +0000 (11:31 -0400)
One uninit warning and one missing lock warning, both were OK but
let's make the tool happy.

Signed-off-by: Christian Hopps <chopps@labn.net>
lib/northbound_grpc.cpp

index dda1756214dcc1ec4796228c51ec031163fc6809..9cb999110b41aab6c65a6851cee9b59f441422de 100644 (file)
@@ -223,7 +223,7 @@ class RpcStateBase
        pthread_mutex_t cmux = PTHREAD_MUTEX_INITIALIZER;
        pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
        CallState state = CREATE;
-       CallState entered_state;
+       CallState entered_state = CREATE;
 
       public:
        const char *name;
@@ -1153,7 +1153,9 @@ static void *grpc_pthread_start(void *arg)
        std::unique_ptr<grpc::Server> server = builder.BuildAndStart();
        s_server = server.get();
 
+       pthread_mutex_lock(&s_server_lock); // Make coverity happy
        grpc_running = true;
+       pthread_mutex_unlock(&s_server_lock); // Make coverity happy
 
        /* Schedule unary RPC handlers */
        REQUEST_NEWRPC(GetCapabilities, NULL);