From c2969f9feb1878cc9dbe143b7adeda56b66557e6 Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 16 Sep 2015 03:36:48 -0300 Subject: conf, help: Fix minor leaks in error conditions From coverity. --- conf.c | 4 ++++ help.c | 1 + 2 files changed, 5 insertions(+) diff --git a/conf.c b/conf.c index e2f29f96..845731b2 100644 --- a/conf.c +++ b/conf.c @@ -73,6 +73,7 @@ conf_t *conf_load(int argc, char *argv[]) i = conf_loadini(conf, global.conf_file); if (i == 0) { fprintf(stderr, "Error: Syntax error in configuration file `%s'.\n", global.conf_file); + conf_free(conf); return NULL; } else if (i == -1) { config_missing++; @@ -135,10 +136,12 @@ conf_t *conf_load(int argc, char *argv[]) " -x Command-line interface to password encryption/hashing\n" " -h Show this help page.\n" " -V Show version info.\n"); + conf_free(conf); return NULL; } else if (opt == 'V') { printf("BitlBee %s\nAPI version %06x\n", BITLBEE_VERSION, BITLBEE_VERSION_CODE); + conf_free(conf); return NULL; } else if (opt == 'u') { g_free(conf->user); @@ -162,6 +165,7 @@ conf_t *conf_load(int argc, char *argv[]) /* Let's treat this as a serious problem so people won't think they're secure when in fact they're not. */ fprintf(stderr, "Error: Could not read CA file %s: %s\n", conf->cafile, strerror(errno)); + conf_free(conf); return NULL; } diff --git a/help.c b/help.c index 65f2ba47..07ba2102 100644 --- a/help.c +++ b/help.c @@ -145,6 +145,7 @@ char *help_get(help_t **help, char *title) if (lseek(h->fd, h->offset.file_offset, SEEK_SET) == -1 || read(h->fd, s, h->length) != h->length) { + g_free(s); return NULL; } } else { -- cgit v1.2.3