[Kde-pim] Review Request: Combined patch: Null checks on pointers

Frank Thieme frank at fthieme.net
Thu Jul 2 11:54:26 BST 2009



> On 2009-07-02 03:01:01, Frank Thieme wrote:
> > you forgot the check in line 1267 -> 1274
> 
> Alvaro Manera wrote:
>     If you mean by that, that this line:
>      } else if ( strcmp( s, "CONFIDENTIAL" ) == 0 ) {
>     doesn't have the check, I don't think it needs it, because even if it is NULL it will go on the first branch. Now what I am thinking is that the check might not be needed in this line either:
>      	1272  	   if ( !s || strcmp( s, "PRIVATE" ) == 0 ) {
>     As in that case, if it's null it will change from public to private.

Yeah, you are right, that is would go in the first branch.

But I think if you want to check s against not being NULL, you can't leave the check out. IMHO you shuld change it to

if ( s && ...) 

on both ifs. This wouldn't change behaviour from the original code...


- Frank


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/924/#review1434
-----------------------------------------------------------


On 2009-07-02 00:54:01, Alvaro Manera wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/924/
> -----------------------------------------------------------
> 
> (Updated 2009-07-02 00:54:01)
> 
> 
> Review request for KDE PIM.
> 
> 
> Summary
> -------
> 
> In this patch I try to fix a few cases where there is no check if the pointer or variables are null.  To avoid such problems as trying to free a null pointer.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdepimlibs/kcal/vcalformat.cpp 990270 
> 
> Diff: http://reviewboard.kde.org/r/924/diff
> 
> 
> Testing
> -------
> 
> Lots of our cases, some of these issues were found running them.
> 
> 
> Thanks,
> 
> Alvaro
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list