summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syscall.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-08-18 11:39:03 +0530
committerNiels de Vos <ndevos@redhat.com>2018-08-19 10:03:52 +0000
commitfab6944206bf44e2260f20a9d5f1e785f933e705 (patch)
tree0eef23967b99436f0aab400b29a4c703a337d3d1 /libglusterfs/src/syscall.c
parent23e2a420f90c4d39386a0c0c2a8bea0e376ab070 (diff)
coverity: libglusterfs issues
CID: 1391415, 1274122, 1274201, 1382408, 1382437, 1389436 1288798, 1288106, 1288110 updates: bz#789278 Change-Id: I48c7a50f22f5f4580310040c66463d9f7dd26204 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src/syscall.c')
-rw-r--r--libglusterfs/src/syscall.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 2d79d695b09..6a17d1ec6ca 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -493,6 +493,8 @@ gf_add_prefix(const char *ns, const char *key, char **newkey)
int ns_length = strlen(ns);
*newkey = GF_MALLOC(ns_length + strlen(key) + 10,
gf_common_mt_char);
+ if (!*newkey)
+ return;
strcpy(*newkey, ns);
strcat(*newkey, key);
} else {
@@ -507,6 +509,8 @@ gf_remove_prefix(const char *ns, const char *key, char **newkey)
if (strncmp(key, ns, ns_length) == 0) {
*newkey = GF_MALLOC(-ns_length + strlen(key) + 10,
gf_common_mt_char);
+ if (!*newkey)
+ return;
strcpy(*newkey, key + ns_length);
} else {
*newkey = gf_strdup(key);