Hi all,

Coverity has pointed out that vacuumlo.c is leaking memory when
grabbing the list of candidate table names and schemas. Attached is a
patch to fix the leak.
Regards,
-- 
Michael
*** a/contrib/vacuumlo/vacuumlo.c
--- b/contrib/vacuumlo/vacuumlo.c
***************
*** 240,245 **** vacuumlo(const char *database, const struct _param * param)
--- 240,251 ----
  			fprintf(stderr, "Out of memory\n");
  			PQclear(res);
  			PQfinish(conn);
+ 			if (schema != NULL)
+ 				PQfreemem(schema);
+ 			if (schema != NULL)
+ 				PQfreemem(table);
+ 			if (schema != NULL)
+ 				PQfreemem(field);
  			return -1;
  		}
  
***************
*** 256,261 **** vacuumlo(const char *database, const struct _param * param)
--- 262,270 ----
  			PQclear(res2);
  			PQclear(res);
  			PQfinish(conn);
+ 			PQfreemem(schema);
+ 			PQfreemem(table);
+ 			PQfreemem(field);
  			return -1;
  		}
  		PQclear(res2);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to