]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Fix some memory leaks in read_config() error path
authorDotan Barak <dotanb@mellanox.co.il>
Tue, 16 Jan 2007 20:26:39 +0000 (12:26 -0800)
committerRoland Dreier <rolandd@cisco.com>
Tue, 16 Jan 2007 20:26:39 +0000 (12:26 -0800)
Don't leak path if stat() fails or file isn't a regular file.

Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
src/init.c

index 3b5fc89d491f7bb24e4c6fa937438f14857741aa..664c5845a6fd00b0f88019645851794bfc3c7c40 100644 (file)
@@ -312,13 +312,14 @@ static void read_config(void)
                if (stat(path, &buf)) {
                        fprintf(stderr, PFX "Warning: couldn't stat config file '%s'.\n",
                                path);
-                       continue;
+                       goto next;
                }
 
                if (!S_ISREG(buf.st_mode))
-                       continue;
+                       goto next;
 
                read_config_file(path);
+       next:
                free(path);
        }