summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/dict.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-28 03:31:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-28 03:34:54 -0700
commit927aedbb556ee07250248181f52642eeb6de9e58 (patch)
tree034a196708a1c1260951cafeefc42b427bee8479 /libglusterfs/src/dict.c
parent753146c0ff4b1b55892b71b36d6ca97797867aaa (diff)
removed last few remaining 'ERR_ABORT's from codebase
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966
Diffstat (limited to 'libglusterfs/src/dict.c')
-rw-r--r--libglusterfs/src/dict.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 1f6011623..4a8945ff1 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -40,11 +40,12 @@ data_pair_t *
get_new_data_pair ()
{
data_pair_t *data_pair_ptr = NULL;
-
+
data_pair_ptr = (data_pair_t *) GF_CALLOC (1, sizeof (data_pair_t),
gf_common_mt_data_pair_t);
- ERR_ABORT (data_pair_ptr);
-
+ if (!data_pair_ptr)
+ gf_log ("dict", GF_LOG_ERROR, "memory alloc failed");
+
return data_pair_ptr;
}
@@ -1064,7 +1065,9 @@ data_to_int64 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
return (int64_t) strtoull (str, NULL, 0);
@@ -1077,7 +1080,9 @@ data_to_int32 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
@@ -1091,7 +1096,9 @@ data_to_int16 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
@@ -1106,7 +1113,9 @@ data_to_int8 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
@@ -1120,7 +1129,9 @@ data_to_uint64 (data_t *data)
if (!data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
@@ -1134,7 +1145,9 @@ data_to_uint32 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';
@@ -1148,7 +1161,9 @@ data_to_uint16 (data_t *data)
return -1;
char *str = alloca (data->len + 1);
- ERR_ABORT (str);
+ if (!str)
+ return -1;
+
memcpy (str, data->data, data->len);
str[data->len] = '\0';