|
From: Philippe W. <phi...@sk...> - 2017-03-15 21:55:10
|
On Wed, 2017-03-15 at 21:28 +0100, Ivo Raisr wrote:
> 2017-03-15 20:35 GMT+01:00 <sv...@va...>:
> > + info = VG_(malloc)("syswrap.ioctl.1", sizeof(*info));
> > + info->data = *data;
> > + info->orig = data;
> > + ARG3 = (Addr)&info->data;
> > }
> > break;
>
> Does this create a memory leak if the ioctl fails?
> I think it does because POST(sys_ioctl) is called only on success.
>
> I can think of several approaches here:
> - have POST(sys_ioctl) called also on failure
> - convey the required information in some other way
> - leave it as is and document somewhere this could leak some memory
Good catch, yes, I think it would leak.
I guess we might have to put the flag SfPostOnFail, like
for ppoll and pselect6 ?
And then, in the POST, just execute the POST_MEM_WRITE operations
if success ?
(and always release the memory)
Philippe
|