From 632cce5e720acaa28ab680a6850f2aa8289d4628 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 17 Jul 2009 22:41:44 +0000 Subject: fix build warnings in 'libglusterfs/' return value of 'asprintf' was not checked, and the flow was continuing without returning error, which could cause potential segfaults in code (mostly possible during ENOMEM case). Signed-off-by: Anand V. Avati BUG: 130 (build warnings) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=130 --- libglusterfs/src/transport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/transport.c') diff --git a/libglusterfs/src/transport.c b/libglusterfs/src/transport.c index 244aa960b..7464ffd66 100644 --- a/libglusterfs/src/transport.c +++ b/libglusterfs/src/transport.c @@ -136,7 +136,11 @@ transport_load (dict_t *options, goto fail; } - asprintf (&name, "%s/%s.so", TRANSPORTDIR, type); + ret = asprintf (&name, "%s/%s.so", TRANSPORTDIR, type); + if (-1 == ret) { + gf_log ("transport", GF_LOG_ERROR, "asprintf failed"); + goto fail; + } gf_log ("transport", GF_LOG_DEBUG, "attempt to load file %s", name); -- cgit