You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

  1. From e871cc2f15ad121e1e840191f59c6c86d6d0580d Mon Sep 17 00:00:00 2001
  2. From: David Carlier <devnexen@gmail.com>
  3. Date: Mon, 22 Aug 2016 23:27:42 +0100
  4. Subject: [PATCH 22/26] MINOR: cfgparse: few memory leaks fixes.
  5. Some minor memory leak during the config parsing.
  6. (cherry picked from commit 70d604593d507f50fd99cebecee4b2c47c1d9b73)
  7. ---
  8. src/cfgparse.c | 7 ++++++-
  9. 1 file changed, 6 insertions(+), 1 deletion(-)
  10. diff --git a/src/cfgparse.c b/src/cfgparse.c
  11. index f2a104d..b8289a2 100644
  12. --- a/src/cfgparse.c
  13. +++ b/src/cfgparse.c
  14. @@ -1597,6 +1597,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
  15. if (logsrv->format < 0) {
  16. Alert("parsing [%s:%d] : unknown log format '%s'\n", file, linenum, args[arg+3]);
  17. err_code |= ERR_ALERT | ERR_FATAL;
  18. + free(logsrv);
  19. goto out;
  20. }
  21. @@ -6777,9 +6778,10 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
  22. }
  23. ag->name = strdup(args[1]);
  24. - if (!ag) {
  25. + if (!ag->name) {
  26. Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
  27. err_code |= ERR_ALERT | ERR_ABORT;
  28. + free(ag);
  29. goto out;
  30. }
  31. @@ -6794,6 +6796,9 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
  32. Alert("parsing [%s:%d]: '%s' only supports 'users' option.\n",
  33. file, linenum, args[0]);
  34. err_code |= ERR_ALERT | ERR_FATAL;
  35. + free(ag->groupusers);
  36. + free(ag->name);
  37. + free(ag);
  38. goto out;
  39. }
  40. }
  41. --
  42. 2.7.3