aboutsummaryrefslogtreecommitdiff
path: root/libcacard
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-10 17:16:03 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-10 17:16:03 +0100
commitb780bf8eff43fc49b071795292dea5d05990fff3 (patch)
tree7186ab9b901ab1d7e67a2097d8825c1691aba478 /libcacard
parent3334e929ae2d01e47c3e64757ee7fcf975cede94 (diff)
parent1a2858995d283ddad4a745460d1cc770a9b93fc1 (diff)
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-10' into staging
trivial patches for 2014-06-10 # gpg: Signature made Tue 10 Jun 2014 17:07:19 BST using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514 66A7 BEE5 9D74 A4C3 D7DB * remotes/mjt/tags/trivial-patches-2014-06-10: (25 commits) virtio.c: fix error message hw: vmware_vga: don't return cursorx when the driver asks for cursory register migration: Plug memory leak in migrate-set-cache-size command libcacard: Clean up dead stores before g_free() libcacard: Drop superfluous conditionals around g_free() cpu/x86: correctly set errors in x86_cpu_parse_featurestr smbios: use g_free directly on NULL pointers vdi: remove double conversion apb: Fix compiler warnings (large constants) hw/net/ne2000-isa: Register vmstate struct target-microblaze: Delete unused sign_extend() function hw/misc/milkymist-softusb: Remove unused softusb_{read, write}_pmem() target-i386/translate.c: Remove unused tcg_gen_lshift() hw/isa/pc87312: Remove unused function is_parallel_epp() hw/intc/openpic: Remove unused function IRQ_testbit() hw/dma/xilinx_axidma: Remove unused stream_halted() function util/qemu-sockets.c: Avoid unused variable warnings hw/sd/sd.c: Drop unused sd_acmd_type[] array hw/i386/pc.c: Remove unused parallel_io and parallel_irq variables slirp: Remove unused zero_ethaddr[] variable ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'libcacard')
-rw-r--r--libcacard/cac.c14
-rw-r--r--libcacard/card_7816.c12
-rw-r--r--libcacard/vcard.c12
-rw-r--r--libcacard/vcard_emul_nss.c4
-rw-r--r--libcacard/vreader.c6
5 files changed, 11 insertions, 37 deletions
diff --git a/libcacard/cac.c b/libcacard/cac.c
index 0a0163d3eb..ae8c3784b9 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 a54f880390..814fa1662f 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 6aaf085ecc..87ad5166a8 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);
}
@@ -119,12 +117,8 @@ vcard_delete_applet(VCardApplet *applet)
}
if (applet->applet_private_free) {
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);
g_free(applet);
}
@@ -178,8 +172,6 @@ vcard_free(VCard *vcard)
}
if (vcard->vcard_private_free) {
(*vcard->vcard_private_free)(vcard->vcard_private);
- vcard->vcard_private_free = 0;
- vcard->vcard_private = 0;
}
for (current_applet = vcard->applet_list; current_applet;
current_applet = next_applet) {
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index cefc38333f..f1bba57c2f 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 d2a9b7df41..9f42f0fe21 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);
}
@@ -345,8 +343,6 @@ vreader_list_delete(VReaderList *list)
next_entry = vreader_list_get_next(current_entry);
vreader_list_entry_delete(current_entry);
}
- list->head = NULL;
- list->tail = NULL;
g_free(list);
}