mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
Merge branch 'static-analysis-fixes' into 'main'
tests: Various static analysis fixes See merge request GNOME/glib!2731
This commit is contained in:
commit
5de59d34e1
@ -249,14 +249,14 @@ int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
GSocket *socket;
|
||||
GSocketAddress *address;
|
||||
GSocket *socket = NULL;
|
||||
GSocketAddress *address = NULL;
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
GCancellable *cancellable;
|
||||
GIOStream *connection;
|
||||
GInputStream *istream;
|
||||
GOutputStream *ostream;
|
||||
GIOStream *connection = NULL;
|
||||
GInputStream *istream = NULL;
|
||||
GOutputStream *ostream = NULL;
|
||||
GSocketAddress *src_address = NULL;
|
||||
GTlsCertificate *certificate = NULL;
|
||||
gint i;
|
||||
|
@ -1555,9 +1555,14 @@ g_ptr_array_free (GPtrArray *array,
|
||||
|
||||
/* if others are holding a reference, preserve the wrapper but
|
||||
* do free/return the data
|
||||
*
|
||||
* Coverity doesn’t understand this and assumes it’s a leak, so comment this
|
||||
* out.
|
||||
*/
|
||||
#ifndef __COVERITY__
|
||||
if (!g_atomic_ref_count_dec (&rarray->ref_count))
|
||||
flags |= PRESERVE_WRAPPER;
|
||||
#endif
|
||||
|
||||
return ptr_array_free (array, flags);
|
||||
}
|
||||
|
@ -3484,8 +3484,19 @@ g_variant_builder_init (GVariantBuilder *builder,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
#ifdef G_ANALYZER_ANALYZING
|
||||
/* Static analysers can’t couple the code in g_variant_builder_init() to the
|
||||
* code in g_variant_builder_end() by GVariantType, so end up assuming that
|
||||
* @offset and @children mismatch and that uninitialised memory is accessed
|
||||
* from @children. At runtime, this is caught by the preconditions at the top
|
||||
* of g_variant_builder_end(). Help the analyser by zero-initialising the
|
||||
* memory to avoid a false positive. */
|
||||
GVSB(builder)->children = g_new0 (GVariant *,
|
||||
GVSB(builder)->allocated_children);
|
||||
#else
|
||||
GVSB(builder)->children = g_new (GVariant *,
|
||||
GVSB(builder)->allocated_children);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -186,7 +186,7 @@ addition_thread (gpointer value)
|
||||
static void
|
||||
test_mutex_perf (gconstpointer data)
|
||||
{
|
||||
guint n_threads = GPOINTER_TO_UINT (data);
|
||||
const guint n_threads = GPOINTER_TO_UINT (data);
|
||||
GThread *threads[THREADS];
|
||||
gint64 start_time;
|
||||
gdouble rate;
|
||||
|
@ -25,11 +25,11 @@
|
||||
#define quick_rand32() \
|
||||
(rand_accu = 1664525 * rand_accu + 1013904223, rand_accu)
|
||||
|
||||
static guint prime_size = 1021; /* 769; 509 */
|
||||
static gboolean clean_memchunks = FALSE;
|
||||
static guint number_of_blocks = 10000; /* total number of blocks allocated */
|
||||
static guint number_of_repetitions = 10000; /* number of alloc+free repetitions */
|
||||
static gboolean want_corruption = FALSE;
|
||||
static const guint prime_size = 1021; /* 769; 509 */
|
||||
static const gboolean clean_memchunks = FALSE;
|
||||
static const guint number_of_blocks = 10000; /* total number of blocks allocated */
|
||||
static const guint number_of_repetitions = 10000; /* number of alloc+free repetitions */
|
||||
static const gboolean want_corruption = FALSE;
|
||||
|
||||
/* --- old memchunk prototypes (memchunks.c) --- */
|
||||
GMemChunk* old_mem_chunk_new (const gchar *name,
|
||||
|
Loading…
Reference in New Issue
Block a user