memcpy: free buffer in case of failure
[fio.git] / lib / memcpy.c
index 8164ba0913e45880341c67c528a2cff2f0a1e0d6..48484390e315f372177afc290530742075449393 100644 (file)
@@ -189,8 +189,11 @@ static int setup_tests(void)
 
        src = malloc(BUF_SIZE);
        dst = malloc(BUF_SIZE);
 
        src = malloc(BUF_SIZE);
        dst = malloc(BUF_SIZE);
-       if (!src || !dst)
+       if (!src || !dst) {
+               free(src);
+               free(dst);
                return 1;
                return 1;
+       }
 
        init_rand_seed(&state, 0x8989, 0);
        fill_random_buf(&state, src, BUF_SIZE);
 
        init_rand_seed(&state, 0x8989, 0);
        fill_random_buf(&state, src, BUF_SIZE);