[openib-general] [libibverbs] [PATCH] Fix some memory leaks in case of error flows during driver init

Dotan Barak dotanb at dev.mellanox.co.il
Tue Jan 16 01:56:53 PST 2007


Fix some memory leaks in case of error flows during driver init.

Signed-off-by: Dotan Barak <dotanb at mellanox.co.il>
---

Index: gen2_devel_user/src/userspace/libibverbs/src/init.c
===================================================================
--- gen2_devel_user.orig/src/userspace/libibverbs/src/init.c	2007-01-15 17:02:23.000000000 +0200
+++ gen2_devel_user/src/userspace/libibverbs/src/init.c	2007-01-15 18:16:07.000000000 +0200
@@ -312,11 +312,14 @@ static void read_config(void)
 		if (stat(path, &buf)) {
 			fprintf(stderr, PFX "Warning: couldn't stat config file '%s'.\n",
 				path);
+			free(path);
 			continue;
 		}
 
-		if (!S_ISREG(buf.st_mode))
+		if (!S_ISREG(buf.st_mode)) {
+			free(path);
 			continue;
+		}
 
 		read_config_file(path);
 		free(path);






More information about the general mailing list