summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorHumble Devassy Chirammal <hchiramm@redhat.com>2015-03-05 14:50:26 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-03-24 07:04:03 -0700
commita37f3ca2b286732fff18f0b0897d8bb1713c89b7 (patch)
tree6f057bf8f62329b899132bdb5a791a3b84a9be34 /libglusterfs
parent33a32b8efac9dbc159c0ed74b9a2a4c6ab686b98 (diff)
libglusterfs: check and act based on gf_malloc result.
Change-Id: If54f4be7db8b6f98e65570b09c07251e21ebae15 BUG: 1194640 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/9837 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/logging.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index ab7b96a54d4..078125088d6 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -870,6 +870,10 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
len = strlen (str1);
msg = GF_MALLOC (len + strlen (str2) + 1, gf_common_mt_char);
+ if (!msg) {
+ ret = -1;
+ goto out;
+ }
strcpy (msg, str1);
strcpy (msg + len, str2);
@@ -1397,6 +1401,10 @@ gf_log_glusterlog (glusterfs_ctx_t *ctx, const char *domain, const char *file,
flen = footer? strlen (footer) : 0;
mlen = strlen (*appmsgstr);
msg = GF_MALLOC (hlen + flen + mlen + 1, gf_common_mt_char);
+ if (!msg) {
+ ret = -1;
+ goto err;
+ }
strcpy (msg, header);
strcpy (msg + hlen, *appmsgstr);
@@ -1531,6 +1539,10 @@ gf_glusterlog_log_repetitions (glusterfs_ctx_t *ctx, const char *domain,
flen = strlen (footer);
mlen = strlen (*appmsgstr);
msg = GF_MALLOC (hlen + flen + mlen + 1, gf_common_mt_char);
+ if (!msg) {
+ ret = -1;
+ goto err;
+ }
strcpy (msg, header);
strcpy (msg + hlen, *appmsgstr);
@@ -2195,6 +2207,9 @@ log:
len = strlen (str1);
msg = GF_MALLOC (len + strlen (str2) + 1, gf_common_mt_char);
+ if (!msg) {
+ goto err;
+ }
strcpy (msg, str1);
strcpy (msg + len, str2);
@@ -2376,6 +2391,9 @@ gf_cmd_log (const char *domain, const char *fmt, ...)
len = strlen (str1);
msg = GF_MALLOC (len + strlen (str2) + 1, gf_common_mt_char);
+ if (!msg) {
+ goto out;
+ }
strcpy (msg, str1);
strcpy (msg + len, str2);