[PATCH] Free some variables so we can http GET twice if needed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader2/ftp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/loader2/ftp.c b/loader2/ftp.c
index 940b8df..fb467c8 100644
--- a/loader2/ftp.c
+++ b/loader2/ftp.c
@@ -740,8 +740,12 @@ int httpGetFileDesc(char * hostname, int port, char * remotename,
 
     if (status == NULL) {
         close(sock);
+        if (status) free(status);
+        if (headers) free(headers);
         return FTPERR_SERVER_IO_ERROR;
     } else if (!strncmp(status, "200", 3)) {
+        if (status) free(status);
+        if (headers) free(headers);
         return sock;
     } else if (!strncmp(status, "301", 3) || !strncmp(status, "302", 3) ||
                !strncmp(status, "303", 3) || !strncmp(status, "307", 3)) {
@@ -749,6 +753,9 @@ int httpGetFileDesc(char * hostname, int port, char * remotename,
         char *redir_loc = find_header (headers, "Location");
         int retval;
 
+        if (status) free(status);
+        if (headers) free(headers);
+
         if (redir_loc == NULL) {
             logMessage(WARNING, "got a redirect response, but Location header is NULL");
             close(sock);
@@ -761,12 +768,18 @@ int httpGetFileDesc(char * hostname, int port, char * remotename,
         free(redir_loc);
         return retval;
     } else if (!strncmp(status, "403", 3)) {
+        if (status) free(status);
+        if (headers) free(headers);
         close(sock);
         return FTPERR_PERMISSION_DENIED;
     } else if (!strncmp(status, "404", 3)) {
+        if (status) free(status);
+        if (headers) free(headers);
         close(sock);
         return FTPERR_FILE_NOT_FOUND;
     } else {
+        if (status) free(status);
+        if (headers) free(headers);
         close(sock);
         logMessage(ERROR, "bad HTTP response code: %s", status);
         return FTPERR_BAD_SERVER_RESPONSE;
-- 
1.5.3.7

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux