uclient-utils: Handle memory allocation failure for url file name
[project/uclient.git] / uclient-fetch.c
index 2e553a0..38c9c53 100644 (file)
@@ -122,6 +122,11 @@ static int open_output_file(const char *path, uint64_t resume_offset)
                }
        } else {
                filename = uclient_get_url_filename(path, "index.html");
+               if (!filename) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+
                output_file = filename;
        }
 
@@ -151,6 +156,7 @@ done:
 
 free:
        free(filename);
+out:
        return ret;
 }
 
@@ -494,7 +500,7 @@ static int no_ssl(const char *progname)
 {
        fprintf(stderr,
                "%s: SSL support not available, please install one of the "
-               "libustream-ssl-* libraries as well as the ca-bundle and "
+               "libustream-.*[ssl|tls] packages as well as the ca-bundle and "
                "ca-certificates packages.\n",
                progname);