engines/http: Fix memory leak
authorPavel Reichl <preichl@redhat.com>
Thu, 14 Dec 2023 21:10:25 +0000 (22:10 +0100)
committerPavel Reichl <preichl@redhat.com>
Thu, 14 Dec 2023 21:10:25 +0000 (22:10 +0100)
Found by Red Hat's OpenScanHub:

fio-3.35/engines/http.c:253: leaked_storage: Variable r going out of scope leaks the storage it points to.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
engines/http.c

index 56dc7d1b14f63d232d49693801109eb9dab5684c..83cfe8bb711fadbec2c9df2a5943978228668b16 100644 (file)
@@ -250,6 +250,7 @@ static char *_aws_uriencode(const char *uri)
        for (i = 0; (c = uri[i]); i++) {
                if (n > bufsize-5) {
                        log_err("encoding the URL failed\n");
+                       free(r);
                        return NULL;
                }