[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/25] libcacard: Drop superfluous conditionals aroun
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 21/25] libcacard: Drop superfluous conditionals around g_free() |
Date: |
Tue, 10 Jun 2014 20:08:39 +0400 |
From: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
libcacard/cac.c | 14 ++++----------
libcacard/card_7816.c | 12 +++---------
libcacard/vcard.c | 10 +++-------
libcacard/vcard_emul_nss.c | 4 +---
libcacard/vreader.c | 4 +---
5 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/libcacard/cac.c b/libcacard/cac.c
index 0a0163d..ae8c378 100644
--- a/libcacard/cac.c
+++ b/libcacard/cac.c
@@ -100,10 +100,8 @@ cac_applet_pki_reset(VCard *card, int channel)
pki_applet = &(applet_private->u.pki_data);
pki_applet->cert_buffer = NULL;
- if (pki_applet->sign_buffer) {
- g_free(pki_applet->sign_buffer);
- pki_applet->sign_buffer = NULL;
- }
+ g_free(pki_applet->sign_buffer);
+ pki_applet->sign_buffer = NULL;
pki_applet->cert_buffer_len = 0;
pki_applet->sign_buffer_len = 0;
return VCARD_DONE;
@@ -285,12 +283,8 @@ cac_delete_pki_applet_private(VCardAppletPrivate
*applet_private)
return;
}
pki_applet_data = &(applet_private->u.pki_data);
- if (pki_applet_data->cert != NULL) {
- g_free(pki_applet_data->cert);
- }
- if (pki_applet_data->sign_buffer != NULL) {
- g_free(pki_applet_data->sign_buffer);
- }
+ g_free(pki_applet_data->cert);
+ g_free(pki_applet_data->sign_buffer);
if (pki_applet_data->key != NULL) {
vcard_emul_delete_key(pki_applet_data->key);
}
diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c
index a54f880..814fa16 100644
--- a/libcacard/card_7816.c
+++ b/libcacard/card_7816.c
@@ -172,16 +172,12 @@ vcard_response_delete(VCardResponse *response)
switch (response->b_type) {
case VCARD_MALLOC:
/* everything was malloc'ed */
- if (response->b_data) {
- g_free(response->b_data);
- }
+ g_free(response->b_data);
g_free(response);
break;
case VCARD_MALLOC_DATA:
/* only the data buffer was malloc'ed */
- if (response->b_data) {
- g_free(response->b_data);
- }
+ g_free(response->b_data);
break;
case VCARD_MALLOC_STRUCT:
/* only the structure was malloc'ed */
@@ -358,9 +354,7 @@ vcard_apdu_delete(VCardAPDU *apdu)
if (apdu == NULL) {
return;
}
- if (apdu->a_data) {
- g_free(apdu->a_data);
- }
+ g_free(apdu->a_data);
g_free(apdu);
}
diff --git a/libcacard/vcard.c b/libcacard/vcard.c
index 6aaf085..bf342aa 100644
--- a/libcacard/vcard.c
+++ b/libcacard/vcard.c
@@ -51,9 +51,7 @@ vcard_buffer_response_delete(VCardBufferResponse
*buffer_response)
if (buffer_response == NULL) {
return;
}
- if (buffer_response->buffer) {
- g_free(buffer_response->buffer);
- }
+ g_free(buffer_response->buffer);
g_free(buffer_response);
}
@@ -121,10 +119,8 @@ vcard_delete_applet(VCardApplet *applet)
applet->applet_private_free(applet->applet_private);
applet->applet_private = NULL;
}
- if (applet->aid) {
- g_free(applet->aid);
- applet->aid = NULL;
- }
+ g_free(applet->aid);
+ applet->aid = NULL;
g_free(applet);
}
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index cefc383..f1bba57 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -471,9 +471,7 @@ vreader_emul_delete(VReaderEmul *vreader_emul)
if (vreader_emul->slot) {
PK11_FreeSlot(vreader_emul->slot);
}
- if (vreader_emul->type_params) {
- g_free(vreader_emul->type_params);
- }
+ g_free(vreader_emul->type_params);
g_free(vreader_emul);
}
diff --git a/libcacard/vreader.c b/libcacard/vreader.c
index d2a9b7d..ffa05b6 100644
--- a/libcacard/vreader.c
+++ b/libcacard/vreader.c
@@ -155,9 +155,7 @@ vreader_free(VReader *reader)
if (reader->card) {
vcard_free(reader->card);
}
- if (reader->name) {
- g_free(reader->name);
- }
+ g_free(reader->name);
if (reader->reader_private_free) {
reader->reader_private_free(reader->reader_private);
}
--
1.7.10.4
- [Qemu-devel] [PULL 00/25] Trivial patches for 2014-06-10, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 02/25] net: cadence_gem: Add Tx descriptor fetch printf, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 06/25] slirp: Remove unused zero_ethaddr[] variable, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 05/25] qtest: fix hex2nib for capital characters, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 04/25] net: cadence_gem: Remove &desc[0] usages, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 10/25] hw/dma/xilinx_axidma: Remove unused stream_halted() function, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 19/25] smbios: use g_free directly on NULL pointers, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 22/25] libcacard: Clean up dead stores before g_free(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 23/25] migration: Plug memory leak in migrate-set-cache-size command, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 21/25] libcacard: Drop superfluous conditionals around g_free(),
Michael Tokarev <=
- [Qemu-devel] [PULL 17/25] apb: Fix compiler warnings (large constants), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 14/25] hw/misc/milkymist-softusb: Remove unused softusb_{read, write}_pmem(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 24/25] hw: vmware_vga: don't return cursorx when the driver asks for cursory register, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 01/25] net: cadence_gem: Fix Tx descriptor update, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 12/25] hw/isa/pc87312: Remove unused function is_parallel_epp(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 03/25] net: cadence_gem: Comment spelling sweep, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 18/25] vdi: remove double conversion, Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 11/25] hw/intc/openpic: Remove unused function IRQ_testbit(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 13/25] target-i386/translate.c: Remove unused tcg_gen_lshift(), Michael Tokarev, 2014/06/10
- [Qemu-devel] [PULL 16/25] hw/net/ne2000-isa: Register vmstate struct, Michael Tokarev, 2014/06/10