summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-12 21:29:21 +0100
committermonsta <[email protected]>2019-07-23 15:57:38 +0300
commitac65bdb624c5abe65026d7df767be1f7c912d5b6 (patch)
treeedcc7bba24f9ddb800cd1c7a3bdded42750d960e /libcaja-private
parentcdfc9f8e90ed44cb7ce5a42e2ab100fde4fb89ab (diff)
downloadcaja-ac65bdb624c5abe65026d7df767be1f7c912d5b6.tar.bz2
caja-ac65bdb624c5abe65026d7df767be1f7c912d5b6.tar.xz
caja-autorun: avoid NULL in 'memcpy'
Fixes Clang static analyzer warning: caja-autorun.c:139:5: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy (r, v, len * sizeof (char *)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-autorun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index e60fe8a6..04033445 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -136,7 +136,10 @@ add_elem_to_str_array (char **v, const char *s)
len = v != NULL ? g_strv_length (v) : 0;
r = g_new0 (char *, len + 2);
- memcpy (r, v, len * sizeof (char *));
+
+ if (v)
+ memcpy (r, v, len * sizeof (char *));
+
r[len] = g_strdup (s);
r[len+1] = NULL;
g_free (v);