pmemblk: Fix a memory leak
authorBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 05:08:10 +0000 (21:08 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 06:04:39 +0000 (22:04 -0800)
This patch fixes the following Coverity complaint:

CID 169312 (#1 of 1): Resource leak (RESOURCE_LEAK)
5. leaked_storage: Variable path going out of scope leaks the storage it points to.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
engines/pmemblk.c

index 45f6fb6501a216b78dbfdae34f7ef3807aa77669..730f4d776f1eb46d8bbfc792ed87b103c078641b 100644 (file)
@@ -226,6 +226,8 @@ static fio_pmemblk_file_t pmb_open(const char *pathspec, int flags)
 
        pthread_mutex_unlock(&CacheLock);
 
 
        pthread_mutex_unlock(&CacheLock);
 
+       free(path);
+
        return pmb;
 
 error:
        return pmb;
 
 error: