Hey Vmailers,

I was wondering why my authdaemond was suddenly taking up more than
100mb memory PER INSTANCE. I found a small memory leak in

if (!(res_read = mysql_store_result(&mysql_read)))
      fprintf(stderr, "vmysql: store result failed 7\n");
      return -1;

  if (mysql_num_rows(res_read) == 0) {
      /* this should not be a fatal error: upgrading gets extremly
annoying elsewise. */
      /*fprintf(stderr, "vmysql: can't find limits for domain '%s',
using defaults.\n", domain);
      return -1;*/
      /* instead, we return the result of our attempt of reading the
limits from the default limits file */
      return vlimits_read_limits_file (VLIMITS_DEFAULT_FILE, limits);


The problem is that, if (mysql_num_rows(res_read) == 0, the function
inmediately returns without freeing res_read.

I attached a little patch that corrects the issue. (simply adds a
mysql_free_result(res_read); )

Tijs Zwinkels

Attachment: vpopmail_limits_mysql_memleak.patch
Description: Binary data

Reply via email to