diff options
author | jbj <jbj> | 2013-06-24 19:52:26 +0000 |
---|---|---|
committer | jbj <jbj> | 2013-06-24 19:52:26 +0000 |
commit | 7e74c468ef3821ecda4c94de6c1b64b26a615b8a (patch) | |
tree | 00d747f019e65fe39bbcfc95793a79bb14f87fed | |
parent | d8a30366a8ca6e87aa42070b1cefdb46157588f2 (diff) | |
download | libpopt-7e74c468ef3821ecda4c94de6c1b64b26a615b8a.tar.gz |
- repair memory leak on failure return.
-rw-r--r-- | poptconfig.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/poptconfig.c b/poptconfig.c index f44be33..0a9a50d 100644 --- a/poptconfig.c +++ b/poptconfig.c @@ -396,8 +396,10 @@ int poptReadConfigFile(poptContext con, const char * fn) if ((rc = poptReadFile(fn, &b, &nb, POPT_READFILE_TRIMNEWLINES)) != 0) return (errno == ENOENT ? 0 : rc); - if (b == NULL || nb == 0) - return POPT_ERROR_BADCONFIG; + if (b == NULL || nb == 0) { + rc = POPT_ERROR_BADCONFIG; + goto exit; + } if ((t = (char*) malloc(nb + 1)) == NULL) goto exit; |