static int get_certificate_status(const char *serial, CA_DB *db)
{
    char *row[DB_NUMBER], **rrow;
    int ok = -1, i;
    size_t serial_len = strlen(serial);
    for (i = 0; i < DB_NUMBER; i++)
        row[i] = NULL;
    row[DB_serial] = app_malloc(serial_len + 2, "row serial#");
    if (serial_len % 2) {
        row[DB_serial][0] = '0';
        memcpy(row[DB_serial] + 1, serial, serial_len);
        row[DB_serial][serial_len + 1] = '\0';
    } else {
        memcpy(row[DB_serial], serial, serial_len);
        row[DB_serial][serial_len] = '\0';
    }
    make_uppercase(row[DB_serial]);
    ok = 1;
    rrow = TXT_DB_get_by_index(db->db, DB_serial, row);
    if (rrow == NULL) {
        BIO_printf(bio_err, "Serial %s not present in db.\n", row[DB_serial]);
        ok = -1;
        goto end;
    } else if (rrow[DB_type][0] == DB_TYPE_VAL) {
        BIO_printf(bio_err, "%s=Valid (%c)\n",
                   row[DB_serial], rrow[DB_type][0]);
        goto end;
    } else if (rrow[DB_type][0] == DB_TYPE_REV) {
        BIO_printf(bio_err, "%s=Revoked (%c)\n",
                   row[DB_serial], rrow[DB_type][0]);
        goto end;
    } else if (rrow[DB_type][0] == DB_TYPE_EXP) {
        BIO_printf(bio_err, "%s=Expired (%c)\n",
                   row[DB_serial], rrow[DB_type][0]);
        goto end;
    } else if (rrow[DB_type][0] == DB_TYPE_SUSP) {
        BIO_printf(bio_err, "%s=Suspended (%c)\n",
                   row[DB_serial], rrow[DB_type][0]);
        goto end;
    } else {
        BIO_printf(bio_err, "%s=Unknown (%c).\n",
                   row[DB_serial], rrow[DB_type][0]);
        ok = -1;
    }
 end:
    for (i = 0; i < DB_NUMBER; i++) {
        OPENSSL_free(row[i]);
    }
    return ok;
}
['static int get_certificate_status(const char *serial, CA_DB *db)\n{\n    char *row[DB_NUMBER], **rrow;\n    int ok = -1, i;\n    size_t serial_len = strlen(serial);\n    for (i = 0; i < DB_NUMBER; i++)\n        row[i] = NULL;\n    row[DB_serial] = app_malloc(serial_len + 2, "row serial#");\n    if (serial_len % 2) {\n        row[DB_serial][0] = \'0\';\n        memcpy(row[DB_serial] + 1, serial, serial_len);\n        row[DB_serial][serial_len + 1] = \'\\0\';\n    } else {\n        memcpy(row[DB_serial], serial, serial_len);\n        row[DB_serial][serial_len] = \'\\0\';\n    }\n    make_uppercase(row[DB_serial]);\n    ok = 1;\n    rrow = TXT_DB_get_by_index(db->db, DB_serial, row);\n    if (rrow == NULL) {\n        BIO_printf(bio_err, "Serial %s not present in db.\\n", row[DB_serial]);\n        ok = -1;\n        goto end;\n    } else if (rrow[DB_type][0] == DB_TYPE_VAL) {\n        BIO_printf(bio_err, "%s=Valid (%c)\\n",\n                   row[DB_serial], rrow[DB_type][0]);\n        goto end;\n    } else if (rrow[DB_type][0] == DB_TYPE_REV) {\n        BIO_printf(bio_err, "%s=Revoked (%c)\\n",\n                   row[DB_serial], rrow[DB_type][0]);\n        goto end;\n    } else if (rrow[DB_type][0] == DB_TYPE_EXP) {\n        BIO_printf(bio_err, "%s=Expired (%c)\\n",\n                   row[DB_serial], rrow[DB_type][0]);\n        goto end;\n    } else if (rrow[DB_type][0] == DB_TYPE_SUSP) {\n        BIO_printf(bio_err, "%s=Suspended (%c)\\n",\n                   row[DB_serial], rrow[DB_type][0]);\n        goto end;\n    } else {\n        BIO_printf(bio_err, "%s=Unknown (%c).\\n",\n                   row[DB_serial], rrow[DB_type][0]);\n        ok = -1;\n    }\n end:\n    for (i = 0; i < DB_NUMBER; i++) {\n        OPENSSL_free(row[i]);\n    }\n    return ok;\n}', 'void* app_malloc(int sz, const char *what)\n{\n    void *vp = OPENSSL_malloc(sz);\n    return vp;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']