From: Dotan Barak Date: Tue, 16 Jan 2007 20:26:39 +0000 (-0800) Subject: Fix some memory leaks in read_config() error path X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d5a3825aca4520ed71d44c5d652f994960d42686;p=~shefty%2Flibibverbs.git Fix some memory leaks in read_config() error path Don't leak path if stat() fails or file isn't a regular file. Signed-off-by: Dotan Barak Signed-off-by: Roland Dreier --- diff --git a/src/init.c b/src/init.c index 3b5fc89..664c584 100644 --- a/src/init.c +++ b/src/init.c @@ -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); }