Skip to content

Commit

Permalink
grpc: add global destructor to avoid leaks when the module is not used
Browse files Browse the repository at this point in the history
valgrind reported memory leaks even when no gRPC plugins were used in
the configuration.

Signed-off-by: László Várady <[email protected]>
  • Loading branch information
MrAnno committed Aug 9, 2024
1 parent 1e56f25 commit fe32c9e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/grpc/protos/apphook.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Axoflow
* Copyright (c) 2024 László Várady
*
* This program is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -58,3 +59,9 @@ grpc_register_global_initializers(void)
initialized = TRUE;
}
}

static void __attribute__((destructor))
_protobuf_cleanup(void)
{
google::protobuf::ShutdownProtobufLibrary();
}

0 comments on commit fe32c9e

Please sign in to comment.