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,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
GSocket *socket;
|
GSocket *socket = NULL;
|
||||||
GSocketAddress *address;
|
GSocketAddress *address = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GIOStream *connection;
|
GIOStream *connection = NULL;
|
||||||
GInputStream *istream;
|
GInputStream *istream = NULL;
|
||||||
GOutputStream *ostream;
|
GOutputStream *ostream = NULL;
|
||||||
GSocketAddress *src_address = NULL;
|
GSocketAddress *src_address = NULL;
|
||||||
GTlsCertificate *certificate = NULL;
|
GTlsCertificate *certificate = NULL;
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -1555,9 +1555,14 @@ g_ptr_array_free (GPtrArray *array,
|
|||||||
|
|
||||||
/* if others are holding a reference, preserve the wrapper but
|
/* if others are holding a reference, preserve the wrapper but
|
||||||
* do free/return the data
|
* 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))
|
if (!g_atomic_ref_count_dec (&rarray->ref_count))
|
||||||
flags |= PRESERVE_WRAPPER;
|
flags |= PRESERVE_WRAPPER;
|
||||||
|
#endif
|
||||||
|
|
||||||
return ptr_array_free (array, flags);
|
return ptr_array_free (array, flags);
|
||||||
}
|
}
|
||||||
|
@ -3484,8 +3484,19 @@ g_variant_builder_init (GVariantBuilder *builder,
|
|||||||
g_assert_not_reached ();
|
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)->children = g_new (GVariant *,
|
||||||
GVSB(builder)->allocated_children);
|
GVSB(builder)->allocated_children);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -186,7 +186,7 @@ addition_thread (gpointer value)
|
|||||||
static void
|
static void
|
||||||
test_mutex_perf (gconstpointer data)
|
test_mutex_perf (gconstpointer data)
|
||||||
{
|
{
|
||||||
guint n_threads = GPOINTER_TO_UINT (data);
|
const guint n_threads = GPOINTER_TO_UINT (data);
|
||||||
GThread *threads[THREADS];
|
GThread *threads[THREADS];
|
||||||
gint64 start_time;
|
gint64 start_time;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
#define quick_rand32() \
|
#define quick_rand32() \
|
||||||
(rand_accu = 1664525 * rand_accu + 1013904223, rand_accu)
|
(rand_accu = 1664525 * rand_accu + 1013904223, rand_accu)
|
||||||
|
|
||||||
static guint prime_size = 1021; /* 769; 509 */
|
static const guint prime_size = 1021; /* 769; 509 */
|
||||||
static gboolean clean_memchunks = FALSE;
|
static const gboolean clean_memchunks = FALSE;
|
||||||
static guint number_of_blocks = 10000; /* total number of blocks allocated */
|
static const guint number_of_blocks = 10000; /* total number of blocks allocated */
|
||||||
static guint number_of_repetitions = 10000; /* number of alloc+free repetitions */
|
static const guint number_of_repetitions = 10000; /* number of alloc+free repetitions */
|
||||||
static gboolean want_corruption = FALSE;
|
static const gboolean want_corruption = FALSE;
|
||||||
|
|
||||||
/* --- old memchunk prototypes (memchunks.c) --- */
|
/* --- old memchunk prototypes (memchunks.c) --- */
|
||||||
GMemChunk* old_mem_chunk_new (const gchar *name,
|
GMemChunk* old_mem_chunk_new (const gchar *name,
|
||||||
|
Loading…
Reference in New Issue
Block a user