Skip to contentSkip to conversation

ila_common.h: Remove redundant check for neutral-map-auto in ila_csum_name2mode function

PATCH New Anton 1 participant 2 messages May 14, 2024

Subsystems (3)
lore
Share & tools
lore

Anton

author
#0 lore raw

PATCH 1/1 ila_common.h: Remove redundant check for neutral-map-auto in ila_csum_name2mode function

The neutral-map-auto option was already handled correctly in the switch statement of the ila_csum_name2mode function. Removing the redundant check for neutral-map-auto simplifies the code without changing its behavior.

---
 ip/ila_common.h | 2 --
 1 file changed, 2 deletions(-)
ip/ila_common.h +0 -2
index f99c2672..ebc2f064 100644
@@ -27,8 +27,6 @@ static inline int ila_csum_name2mode(char *name)
 		return ILA_CSUM_ADJUST_TRANSPORT;
 	else if (strcmp(name, "neutral-map") == 0)
 		return ILA_CSUM_NEUTRAL_MAP;
-	else if (strcmp(name, "neutral-map-auto") == 0)
-		return ILA_CSUM_NEUTRAL_MAP_AUTO;
 	else if (strcmp(name, "no-action") == 0)
 		return ILA_CSUM_NO_ACTION;
 	else if (strcmp(name, "neutral-map-auto") == 0)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/1 utils.c: Fixed potential memory leak in getcmdline function

The getcmdline function in utils.c dynamically allocates memory for the line1 variable using getline function but fails to free it in case of an error. Added a check to free the allocated memory if getline returns a negative value, preventing potential memory leaks.

---
 lib/utils.c | 3 +++
 1 file changed, 3 insertions(+)
lib/utils.c +3 -0
index 051cff9c..d46b47fb 100644
@@ -1339,6 +1339,9 @@ static ssize_t getcmdline(char **linep, size_t *lenp, FILE *in)
 		cc1 = getline(&line1, &len1, in);
 		if (cc1 < 0) {
 			fprintf(stderr, "Missing continuation line\n");
+			if (line1) {
+				free(line1); 
+			}
 			return cc1;
 		}
 
Signature · 1 line
2.43.0