summaryrefslogtreecommitdiff
path: root/console-client
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-08-05 19:28:38 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 19:34:28 +0200
commit66553fd7a7bcf7c260b45f2e7ad54e98d33f8080 (patch)
tree154a543b44a17302b6618cb9c80d7e6b66703216 /console-client
parent835b293d35a209d38047126443d41fa7090daa4c (diff)
Simplify deallocations.
free (NULL) is a nop, therefore it is not necessary to check that first. Simplify the code accordingly. This commit is the result of the following semantic patch: @@ identifier X; @@ -if (X) free (X); +free (X); * console-client/console.c: Simplify accordingly. * console-client/driver.c: Likewise. * console-client/vga.c: Likewise. * ftpfs/dir.c: Likewise. * libftpconn/unix.c: Likewise. * libps/fmt.c: Likewise. * libps/proclist.c: Likewise. * libstore/mvol.c: Likewise. * nfs/ops.c: Likewise. * proc/host.c: Likewise. * sutils/fstab.c: Likewise.
Diffstat (limited to 'console-client')
-rw-r--r--console-client/console.c3
-rw-r--r--console-client/driver.c6
-rw-r--r--console-client/vga.c12
3 files changed, 7 insertions, 14 deletions
diff --git a/console-client/console.c b/console-client/console.c
index 5335156b..3b316115 100644
--- a/console-client/console.c
+++ b/console-client/console.c
@@ -563,8 +563,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
char *s;
char *d;
- if (driver_path)
- free (driver_path);
+ free (driver_path);
driver_path = malloc (strlen (arg) + 2);
if (!driver_path)
{
diff --git a/console-client/driver.c b/console-client/driver.c
index 7a55bbe4..b4a03ab8 100644
--- a/console-client/driver.c
+++ b/console-client/driver.c
@@ -117,8 +117,7 @@ error_t driver_add (const char *const name, const char *const driver,
while (dir)
{
- if (filename)
- free (filename);
+ free (filename);
if (asprintf (&filename,
"%s/%s%s", dir, driver, CONSOLE_SONAME_SUFFIX) < 0)
{
@@ -156,8 +155,7 @@ error_t driver_add (const char *const name, const char *const driver,
if (!shobj)
{
- if (filename)
- free (filename);
+ free (filename);
pthread_mutex_unlock (&driver_list_lock);
return ENOENT;
}
diff --git a/console-client/vga.c b/console-client/vga.c
index 9d751a7f..e954013d 100644
--- a/console-client/vga.c
+++ b/console-client/vga.c
@@ -385,14 +385,10 @@ vga_display_fini (void *handle, int force)
free (disp);
dynacolor_fini ();
vga_fini ();
- if (vga_display_font)
- free (vga_display_font);
- if (vga_display_font_italic)
- free (vga_display_font_italic);
- if (vga_display_font_bold)
- free (vga_display_font_bold);
- if (vga_display_font_bold_italic)
- free (vga_display_font_bold_italic);
+ free (vga_display_font);
+ free (vga_display_font_italic);
+ free (vga_display_font_bold);
+ free (vga_display_font_bold_italic);
return 0;
}