Re: [PATCH libXau 0/3] remove redundant null check on calling free()
Am 28.10.2017 19:16 schrieb "walter harms": After the last patch for libXau i checked the code with smatch and started to remove remove redundant One redundant "remove" here. ;-) All 3 patches are Reviewed-by: Daniel Martin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXau 3/3] AuRead.c: remove redundant null check on calling free()
this removes simply unneeded code from XauReadAuth Signed-off-by: Walter Harms--- AuRead.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/AuRead.c b/AuRead.c index 5d41f03..d48906b 100644 --- a/AuRead.c +++ b/AuRead.c @@ -77,25 +77,25 @@ XauReadAuth (FILE *auth_file) if (read_counted_string (_length, , auth_file) == 0) return NULL; if (read_counted_string (_length, , auth_file) == 0) { - if (local.address) free (local.address); + free (local.address); return NULL; } if (read_counted_string (_length, , auth_file) == 0) { - if (local.address) free (local.address); - if (local.number) free (local.number); + free (local.address); + free (local.number); return NULL; } if (read_counted_string (_length, , auth_file) == 0) { - if (local.address) free (local.address); - if (local.number) free (local.number); - if (local.name) free (local.name); + free (local.address); + free (local.number); + free (local.name); return NULL; } ret = (Xauth *) malloc (sizeof (Xauth)); if (!ret) { - if (local.address) free (local.address); - if (local.number) free (local.number); - if (local.name) free (local.name); + free (local.address); + free (local.number); + free (local.name); if (local.data) { bzero (local.data, local.data_length); free (local.data); -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXau 2/3]Au FileName.c: remove redundant null check on calling free()
remove redundant null check on calling free() Signed-off-by: Walter Harms--- AuFileName.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AuFileName.c b/AuFileName.c index 2946c80..4ccda9d 100644 --- a/AuFileName.c +++ b/AuFileName.c @@ -68,8 +68,7 @@ XauFileName (void) } size = strlen (name) + strlen([1]) + 2; if ((size > bsize) || (buf == NULL)) { - if (buf) - free (buf); + free (buf); assert(size > 0); buf = malloc (size); if (!buf) { -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXau 1/3] AuDispose.c:remove redundant null check on calling free()
redundant null check on auth->address calling free() redundant null check on auth->number calling free() redundant null check on auth->name calling free() Signed-off-by: Walter Harms--- AuDispose.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AuDispose.c b/AuDispose.c index 2a9b2f1..355224d 100644 --- a/AuDispose.c +++ b/AuDispose.c @@ -34,9 +34,9 @@ void XauDisposeAuth (Xauth *auth) { if (auth) { - if (auth->address) (void) free (auth->address); - if (auth->number) (void) free (auth->number); - if (auth->name) (void) free (auth->name); + free (auth->address); + free (auth->number); + free (auth->name); if (auth->data) { (void) bzero (auth->data, auth->data_length); (void) free (auth->data); -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH libXau 0/3] remove redundant null check on calling free()
After the last patch for libXau i checked the code with smatch and started to remove remove redundant null checks. just some cleanup. re, wh ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel