[master] b4fc49a On error free any allocated resources

Federico G. Schwindt fgsch at lodoss.net
Sat May 13 15:01:06 CEST 2017


commit b4fc49a92a67480b763da21fd2b0087357b0fac4
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sat May 13 13:33:41 2017 +0100

    On error free any allocated resources
    
    Spotted by coverity.

diff --git a/lib/libvarnish/vin.c b/lib/libvarnish/vin.c
index 1cb064c..9e47867 100644
--- a/lib/libvarnish/vin.c
+++ b/lib/libvarnish/vin.c
@@ -34,6 +34,7 @@
 #include <limits.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -89,8 +90,10 @@ VIN_n_Arg(const char *n_arg, char **name, char **dir)
 	}
 	if (dir != NULL) {
 		*dir = strdup(dn);
-		if (*dir == NULL)
+		if (*dir == NULL) {
+			free(*name);
 			return (-1);
+		}
 	}
 	return (0);
 }



More information about the varnish-commit mailing list