Review Request 125969: kinit: fix Coverity issues + small optimization
Alex Merry
alex.merry at kde.org
Fri Nov 6 00:06:51 UTC 2015
> On Nov. 5, 2015, 11:37 p.m., Alex Merry wrote:
> > src/kdeinit/kinit.cpp, line 370
> > <https://git.reviewboard.kde.org/r/125969/diff/1/?file=415537#file415537line370>
> >
> > Why call fromRawData with an explicit strlen()? QByteArray(displayEnvVarName()) will have the same effect.
>
> Nick Shaforostoff wrote:
> fromRawData doesn't copy the data provided. the deep copy will be made later by operator+ into a properly sized qbytearray to store "="-ending string
Ah, ok, makes sense. It would be a bit nicer to wrap up getting displayEnvVarName() as a QByteArray in a function that was next to the definition of displayEnvVarName() in the file - given the lifetime constraints of fromRawData, it's nice to be able to see easily from where it is used that those constraints will be satisfied.
- Alex
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125969/#review88068
-----------------------------------------------------------
On Nov. 5, 2015, 10:16 p.m., Nick Shaforostoff wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125969/
> -----------------------------------------------------------
>
> (Updated Nov. 5, 2015, 10:16 p.m.)
>
>
> Review request for KDE Frameworks and Alex Merry.
>
>
> Repository: kinit
>
>
> Description
> -------
>
> this patch fixes two coverity issues ranked 'outstanding':
> https://scan5.coverity.com/reports.htm#v39099/p10103/fileInstanceId=82663767&defectInstanceId=24554334&mergedDefectId=258481
> https://scan5.coverity.com/reports.htm#v39099/p10103/fileInstanceId=82663767&defectInstanceId=24557588&mergedDefectId=258474
>
> and also does small string-related optimization by eliminating redundant mallocs done by QByteArray ctor
>
>
> Diffs
> -----
>
> src/kdeinit/kinit.cpp 9e775b6
>
> Diff: https://git.reviewboard.kde.org/r/125969/diff/
>
>
> Testing
> -------
>
> compiles fine
>
>
> Thanks,
>
> Nick Shaforostoff
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151106/90922218/attachment.html>
More information about the Kde-frameworks-devel
mailing list