Commit 6b1305fa authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

smd: Plug inconsequential leak

The debug stevedore only acts as a wrapper around the malloc storage, so
it proxies its initialization method. The allocation of av isn't tracked
so it leaks when it runs out of scope, along with the copies of values
assigned to the array.

Since a reference to aav is kept in stevedore::av, we can safely pass
direct references to arguments to the underlying malloc storage instead
of copies.

Spotted by asan.
parent 870f16ce
......@@ -80,7 +80,7 @@ smd_init(struct stevedore *parent, int aac, char * const *aav)
methods->objgetspace = smd_lsp_getspace;
continue;
}
REPLACE(av[ac], aav[i]);
av[ac] = aav[i];
ac++;
}
assert(ac >= 0);
......@@ -88,6 +88,7 @@ smd_init(struct stevedore *parent, int aac, char * const *aav)
AZ(av[ac]);
sma_stevedore.init(parent, ac, av);
free(av);
}
const struct stevedore smd_stevedore = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment