[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 12/12] livepatch: Add python bindings for livepatch operations




> On 30. Sep 2019, at 17:13, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx> wrote:
> 
> On 9/28/19 4:13 PM, Pawel Wieczorkiewicz wrote:
>> Extend the XC python bindings library to support also all common
snip
>> 
>> +
>> +    fd = open(filename, O_RDONLY);
>> +    if ( fd < 0 )
>> +        goto error;
>> +
>> +    if ( fstat(fd, &buf) != 0 )
>> +        goto error;
>> +
>> +    len = buf.st_size;
>> +    fbuf = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 0);
>> +    if ( fbuf == MAP_FAILED )
>> +        goto error;
>> +
>> +    rc = xc_livepatch_upload(self->xc_handle, name, fbuf, len);
>> +
>> +    saved_errno = errno;
>> +    munmap(fbuf, len);
>> +    close(fd);
>> +    errno = saved_errno;
>> +
>> +error:
>> +    return rc ? pyxc_error_to_exception(self->xc_handle) : Py_None;
>> +}
>> +
> The fstat() and mmap() error paths leak fd on error.
> 

Oh boy, the better is sometimes an enemy of good :-).
I will fix it, thanks!

> Regards,
> -- 
> Ross Lagerwall

Best Regards,
Pawel Wieczorkiewicz






Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.