~ubuntu-branches/ubuntu/raring/qemu-kvm/raring

« back to all changes in this revision

Viewing changes to libcacard/card_7816.c

  • Committer: Serge Hallyn
  • Date: 2011-12-06 22:40:24 UTC
  • mfrom: (1.2.8)
  • Revision ID: serge.hallyn@ubuntu.com-20111206224024-x6bw4wnn65pgf55v
Tags: 1.0+noroms-0ubuntu1
* New upstream release
* Remaining changes from upstream:
  - removed all binary roms and tests/pi_10.com
* debian/qemu-kvm.links: qemu is now called qemu-system-i386, don't symlink
  it
* remove patches applied upstream:
  - debian/patches/vpc.patch
  - debian/patches/e1000-Dont-set-the-Capabilities-List-bit.patch
  - debian/patches/CVE-2011-4111.patch
* replace default-to-tcg.patch with simpler fallback-to-tcg.patch
* keep remaining patches:
  - larger_default_ram_size.patch
  - CVE-2011-2212-virtqueue-indirect-overflow.patch
  - qemuifup-fix-paths.patch
  - dont-try-to-hotplug-cpu.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
{
52
52
    VCardResponse *new_response;
53
53
 
54
 
    new_response = (VCardResponse *)qemu_malloc(sizeof(VCardResponse));
55
 
    new_response->b_data = qemu_malloc(len + 2);
 
54
    new_response = (VCardResponse *)g_malloc(sizeof(VCardResponse));
 
55
    new_response->b_data = g_malloc(len + 2);
56
56
    memcpy(new_response->b_data, buf, len);
57
57
    new_response->b_total_len = len+2;
58
58
    new_response->b_len = len;
132
132
{
133
133
    VCardResponse *new_response;
134
134
 
135
 
    new_response = (VCardResponse *)qemu_malloc(sizeof(VCardResponse));
 
135
    new_response = (VCardResponse *)g_malloc(sizeof(VCardResponse));
136
136
    new_response->b_data = &new_response->b_sw1;
137
137
    new_response->b_len = 0;
138
138
    new_response->b_total_len = 2;
149
149
{
150
150
    VCardResponse *new_response;
151
151
 
152
 
    new_response = (VCardResponse *)qemu_malloc(sizeof(VCardResponse));
 
152
    new_response = (VCardResponse *)g_malloc(sizeof(VCardResponse));
153
153
    new_response->b_data = &new_response->b_sw1;
154
154
    new_response->b_len = 0;
155
155
    new_response->b_total_len = 2;
173
173
    case VCARD_MALLOC:
174
174
        /* everything was malloc'ed */
175
175
        if (response->b_data) {
176
 
            qemu_free(response->b_data);
 
176
            g_free(response->b_data);
177
177
        }
178
 
        qemu_free(response);
 
178
        g_free(response);
179
179
        break;
180
180
    case VCARD_MALLOC_DATA:
181
181
        /* only the data buffer was malloc'ed */
182
182
        if (response->b_data) {
183
 
            qemu_free(response->b_data);
 
183
            g_free(response->b_data);
184
184
        }
185
185
        break;
186
186
    case VCARD_MALLOC_STRUCT:
187
187
        /* only the structure was malloc'ed */
188
 
        qemu_free(response);
 
188
        g_free(response);
189
189
        break;
190
190
    case VCARD_STATIC:
191
191
        break;
336
336
        return NULL;
337
337
    }
338
338
 
339
 
    new_apdu = (VCardAPDU *)qemu_malloc(sizeof(VCardAPDU));
340
 
    new_apdu->a_data = qemu_malloc(len);
 
339
    new_apdu = (VCardAPDU *)g_malloc(sizeof(VCardAPDU));
 
340
    new_apdu->a_data = g_malloc(len);
341
341
    memcpy(new_apdu->a_data, raw_apdu, len);
342
342
    new_apdu->a_len = len;
343
343
    *status = vcard_apdu_set_class(new_apdu);
344
344
    if (*status != VCARD7816_STATUS_SUCCESS) {
345
 
        qemu_free(new_apdu);
 
345
        g_free(new_apdu);
346
346
        return NULL;
347
347
    }
348
348
    *status = vcard_apdu_set_length(new_apdu);
349
349
    if (*status != VCARD7816_STATUS_SUCCESS) {
350
 
        qemu_free(new_apdu);
 
350
        g_free(new_apdu);
351
351
        new_apdu = NULL;
352
352
    }
353
353
    return new_apdu;
360
360
        return;
361
361
    }
362
362
    if (apdu->a_data) {
363
 
        qemu_free(apdu->a_data);
 
363
        g_free(apdu->a_data);
364
364
    }
365
 
    qemu_free(apdu);
 
365
    g_free(apdu);
366
366
}
367
367
 
368
368
 
754
754
        return vcard7816_vm_process_apdu(card, apdu, response);
755
755
    case VCARD_DIRECT:
756
756
        /* if we are type direct, then the applet should handle everything */
757
 
        assert("VCARD_DIRECT: applet failure");
 
757
        assert(!"VCARD_DIRECT: applet failure");
758
758
        break;
759
759
    }
760
760
    *response =