[PATCH 3/5] mainconfig: check error return codes from logsys_format_set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

and avoid yet another gcc warning

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 282f02c... 7fcc2b0... M	exec/mainconfig.c
 exec/mainconfig.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/exec/mainconfig.c b/exec/mainconfig.c
index 282f02c..7fcc2b0 100644
--- a/exec/mainconfig.c
+++ b/exec/mainconfig.c
@@ -138,7 +138,7 @@ static int corosync_main_config_format_set (
 	const char *error_reason;
 	char new_format_buffer[PATH_MAX];
 	char *value = NULL;
-	cs_error_t err;
+	int err = 0;
 
 	if (icmap_get_string("logging.fileline", &value) == CS_OK) {
 		if (strcmp (value, "on") == 0) {
@@ -163,6 +163,11 @@ static int corosync_main_config_format_set (
 		free(value);
 	}
 
+	if (err) {
+		error_reason = "not enough memory to set logging format buffer";
+		goto parse_error;
+	}
+
 	if (icmap_get_string("logging.function_name", &value) == CS_OK) {
 		if (strcmp (value, "on") == 0) {
 			if (!insert_into_buffer(new_format_buffer,
@@ -186,6 +191,11 @@ static int corosync_main_config_format_set (
 		free(value);
 	}
 
+	if (err) {
+		error_reason = "not enough memory to set logging format buffer";
+		goto parse_error;
+	}
+
 	if (icmap_get_string("logging.timestamp", &value) == CS_OK) {
 		if (strcmp (value, "on") == 0) {
 			if(!insert_into_buffer(new_format_buffer,
@@ -204,6 +214,11 @@ static int corosync_main_config_format_set (
 		free(value);
 	}
 
+	if (err) {
+		error_reason = "not enough memory to set logging format buffer";
+		goto parse_error;
+	}
+
 	return (0);
 
 parse_error:
-- 
1.7.7.5

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux