Skip to content

Commit

Permalink
varnish: fix some leaks in error paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenk authored and octo committed Jul 10, 2015
1 parent 24c2f24 commit f8428bc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/varnish.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ static int varnish_read (user_data_t *ud) /* {{{ */
status = VSM_n_Arg (vd, conf->instance);
if (status < 0)
{
VSM_Delete (vd);
ERROR ("varnish plugin: VSM_n_Arg (\"%s\") failed "
"with status %i.",
conf->instance, status);
Expand All @@ -621,7 +622,8 @@ static int varnish_read (user_data_t *ud) /* {{{ */
if (VSM_Open (vd))
#endif
{
ERROR ("varnish plugin: Unable to load statistics.");
VSM_Delete (vd);
ERROR ("varnish plugin: Unable to open connection.");

return (-1);
}
Expand All @@ -631,6 +633,14 @@ static int varnish_read (user_data_t *ud) /* {{{ */
#else /* if HAVE_VARNISH_V4 */
stats = VSC_Main(vd, NULL);
#endif
if (!stats)
{
VSM_Delete (vd);
ERROR ("varnish plugin: Unable to get statistics.");

return (-1);
}


varnish_monitor (conf, stats);
VSM_Close (vd);
Expand Down

0 comments on commit f8428bc

Please sign in to comment.