get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/805841/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 805841,
    "url": "http://patchwork.ozlabs.org/api/patches/805841/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20170825111732.431-1-phil@nwl.cc/",
    "project": {
        "id": 26,
        "url": "http://patchwork.ozlabs.org/api/projects/26/?format=api",
        "name": "Netfilter Development",
        "link_name": "netfilter-devel",
        "list_id": "netfilter-devel.vger.kernel.org",
        "list_email": "netfilter-devel@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170825111732.431-1-phil@nwl.cc>",
    "list_archive_url": null,
    "date": "2017-08-25T11:17:32",
    "name": "[nft] parser: Fix memleaks for STRING token (and derived ones)",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "901315b396bda171ef54db6d512ef80e43f6ba17",
    "submitter": {
        "id": 4285,
        "url": "http://patchwork.ozlabs.org/api/people/4285/?format=api",
        "name": "Phil Sutter",
        "email": "phil@nwl.cc"
    },
    "delegate": {
        "id": 6139,
        "url": "http://patchwork.ozlabs.org/api/users/6139/?format=api",
        "username": "pablo",
        "first_name": "Pablo",
        "last_name": "Neira",
        "email": "pablo@netfilter.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20170825111732.431-1-phil@nwl.cc/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/805841/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/805841/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netfilter-devel-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netfilter-devel-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xdzCt2dlWz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 25 Aug 2017 21:17:46 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1756163AbdHYLRp (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 25 Aug 2017 07:17:45 -0400",
            "from orbyte.nwl.cc ([151.80.46.58]:51547 \"EHLO mail.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1755842AbdHYLRo (ORCPT <rfc822; netfilter-devel@vger.kernel.org>);\n\tFri, 25 Aug 2017 07:17:44 -0400",
            "from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 69FDC63860;\n\tFri, 25 Aug 2017 13:17:43 +0200 (CEST)",
            "from xsao (localhost [IPv6:::1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 4526C6385C;\n\tFri, 25 Aug 2017 13:17:43 +0200 (CEST)"
        ],
        "From": "Phil Sutter <phil@nwl.cc>",
        "To": "Pablo Neira Ayuso <pablo@netfilter.org>",
        "Cc": "netfilter-devel@vger.kernel.org",
        "Subject": "[nft PATCH] parser: Fix memleaks for STRING token (and derived ones)",
        "Date": "Fri, 25 Aug 2017 13:17:32 +0200",
        "Message-Id": "<20170825111732.431-1-phil@nwl.cc>",
        "X-Mailer": "git-send-email 2.13.1",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Sender": "netfilter-devel-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netfilter-devel.vger.kernel.org>",
        "X-Mailing-List": "netfilter-devel@vger.kernel.org"
    },
    "content": "The common paradigm here is that all parser rules converting string\ntokens into symbols must free the string token if it's not used anymore.\nThis is unrelated to the %destructor directive, since that will apply\nonly if the parser discards the token, which is not the case then.\n\nWhile being at it, simplify error handling in parser rule for listing\nconntrack helpers (error() won't return NULL) and drop the unused extra\nparameter passed to error() in level_type rule.\n\nSigned-off-by: Phil Sutter <phil@nwl.cc>\n---\n src/parser_bison.y | 46 ++++++++++++++++++++++++++++++++++++----------\n src/rule.c         |  1 +\n 2 files changed, 37 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/parser_bison.y b/src/parser_bison.y\nindex d149178c2679b..d4b29029186b2 100644\n--- a/src/parser_bison.y\n+++ b/src/parser_bison.y\n@@ -724,6 +724,7 @@ common_block\t\t:\tINCLUDE\t\tQUOTED_STRING\tstmt_separator\n \t\t\t\tif (symbol_lookup(scope, $2) != NULL) {\n \t\t\t\t\terec_queue(error(&@2, \"redefinition of symbol '%s'\", $2),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($2);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n \n@@ -860,6 +861,7 @@ add_cmd\t\t\t:\tTABLE\t\ttable_spec\n \t\t\t\tint type;\n \n \t\t\t\terec = ct_objtype_parse(&@$, $2, &type);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -939,6 +941,7 @@ create_cmd\t\t:\tTABLE\t\ttable_spec\n \t\t\t\tint type;\n \n \t\t\t\terec = ct_objtype_parse(&@$, $2, &type);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -992,6 +995,7 @@ delete_cmd\t\t:\tTABLE\t\ttable_spec\n \t\t\t\tint type;\n \n \t\t\t\terec = ct_objtype_parse(&@$, $2, &type);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -1079,6 +1083,7 @@ list_cmd\t\t:\tTABLE\t\ttable_spec\n \t\t\t\tint type;\n \n \t\t\t\terec = ct_objtype_parse(&@$, $2, &type);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -1093,16 +1098,12 @@ list_cmd\t\t:\tTABLE\t\ttable_spec\n \t\t\t\tif (strcmp($2, \"helpers\") == 0) {\n \t\t\t\t\tcmd = CMD_OBJ_CT_HELPERS;\n \t\t\t\t} else {\n-\t\t\t\t\tstruct error_record *erec;\n-\n-\t\t\t\t\terec = error(&@$, \"unknown ct class '%s', want 'helpers'\", $2);\n-\n-\t\t\t\t\tif (erec != NULL) {\n-\t\t\t\t\t\terec_queue(erec, state->msgs);\n-\t\t\t\t\t\tYYERROR;\n-\t\t\t\t\t} else\n-\t\t\t\t\t\tYYERROR;\n+\t\t\t\t\terec_queue(error(&@$, \"unknown ct class '%s', want 'helpers'\", $2),\n+\t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($2);\n+\t\t\t\t\tYYERROR;\n \t\t\t\t}\n+\t\t\t\txfree($2);\n \n \t\t\t\t$$ = cmd_alloc(CMD_LIST, cmd, &$4, &@$, NULL);\n \t\t\t}\n@@ -1231,9 +1232,11 @@ table_options\t\t:\tFLAGS\t\tSTRING\n \t\t\t{\n \t\t\t\tif (strcmp($2, \"dormant\") == 0) {\n \t\t\t\t\t$<table>0->flags = TABLE_F_DORMANT;\n+\t\t\t\t\txfree($2);\n \t\t\t\t} else {\n \t\t\t\t\terec_queue(error(&@2, \"unknown table option %s\", $2),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($2);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n \t\t\t}\n@@ -1302,6 +1305,7 @@ table_block\t\t:\t/* empty */\t{ $$ = $<table>-1; }\n \t\t\t\tint type;\n \n \t\t\t\terec = ct_objtype_parse(&@$, $3, &type);\n+\t\t\t\txfree($3);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -1478,8 +1482,10 @@ type_identifier_list\t:\ttype_identifier\n \t\t\t\tif (dtype == NULL) {\n \t\t\t\t\terec_queue(error(&@3, \"unknown datatype %s\", $3),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($3);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n+\t\t\t\txfree($3);\n \t\t\t\t$$ = concat_subtype_add($$, dtype->type);\n \t\t\t}\n \t\t\t;\n@@ -1533,6 +1539,7 @@ hook_spec\t\t:\tTYPE\t\tSTRING\t\tHOOK\t\tSTRING\t\tdev_spec\tPRIORITY\tprio_spec\n \t\t\t\tif (chain_type == NULL) {\n \t\t\t\t\terec_queue(error(&@2, \"unknown chain type %s\", $2),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($2);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n \t\t\t\t$<chain>0->type\t\t= xstrdup(chain_type);\n@@ -1542,6 +1549,7 @@ hook_spec\t\t:\tTYPE\t\tSTRING\t\tHOOK\t\tSTRING\t\tdev_spec\tPRIORITY\tprio_spec\n \t\t\t\tif ($<chain>0->hookstr == NULL) {\n \t\t\t\t\terec_queue(error(&@4, \"unknown chain hook %s\", $4),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($4);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n \t\t\t\txfree($4);\n@@ -1589,6 +1597,7 @@ time_spec\t\t:\tSTRING\n \t\t\t\tuint64_t res;\n \n \t\t\t\terec = time_parse(&@1, $1, &res);\n+\t\t\t\txfree($1);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -1919,10 +1928,12 @@ level_type\t\t:\tstring\n \t\t\t\telse if (!strcmp(\"debug\", $1))\n \t\t\t\t\t$$ = LOG_DEBUG;\n \t\t\t\telse {\n-\t\t\t\t\terec_queue(error(&@1, \"invalid log level\", $1),\n+\t\t\t\t\terec_queue(error(&@1, \"invalid log level\"),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($1);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n+\t\t\t\txfree($1);\n \t\t\t}\n \t\t\t;\n \n@@ -1980,6 +1991,7 @@ limit_stmt\t\t:\tLIMIT\tRATE\tlimit_mode\tNUM\tSLASH\ttime_unit\tlimit_burst\n \t\t\t\tuint64_t rate, unit;\n \n \t\t\t\terec = rate_parse(&@$, $5, &rate, &unit);\n+\t\t\t\txfree($5);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -2010,6 +2022,7 @@ quota_used\t\t:\t/* empty */\t{ $$ = 0; }\n \t\t\t\tuint64_t rate;\n \n \t\t\t\terec = data_unit_parse(&@$, $3, &rate);\n+\t\t\t\txfree($3);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -2024,6 +2037,7 @@ quota_stmt\t\t:\tQUOTA\tquota_mode NUM quota_unit quota_used\n \t\t\t\tuint64_t rate;\n \n \t\t\t\terec = data_unit_parse(&@$, $4, &rate);\n+\t\t\t\txfree($4);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -2055,6 +2069,7 @@ limit_burst\t\t:\t/* empty */\t\t\t{ $$ = 0; }\n \t\t\t\tuint64_t rate;\n \n \t\t\t\terec = data_unit_parse(&@$, $3, &rate);\n+\t\t\t\txfree($3);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -2093,6 +2108,7 @@ reject_opts\t\t:       /* empty */\n \t\t\t\t\t\t\t  current_scope(state),\n \t\t\t\t\t\t\t  $4);\n \t\t\t\t$<stmt>0->reject.expr->dtype = &icmp_code_type;\n+\t\t\t\txfree($4);\n \t\t\t}\n \t\t\t|\tWITH\tICMP6\tTYPE\tSTRING\n \t\t\t{\n@@ -2103,6 +2119,7 @@ reject_opts\t\t:       /* empty */\n \t\t\t\t\t\t\t  current_scope(state),\n \t\t\t\t\t\t\t  $4);\n \t\t\t\t$<stmt>0->reject.expr->dtype = &icmpv6_code_type;\n+\t\t\t\txfree($4);\n \t\t\t}\n \t\t\t|\tWITH\tICMPX\tTYPE\tSTRING\n \t\t\t{\n@@ -2112,6 +2129,7 @@ reject_opts\t\t:       /* empty */\n \t\t\t\t\t\t\t  current_scope(state),\n \t\t\t\t\t\t\t  $4);\n \t\t\t\t$<stmt>0->reject.expr->dtype = &icmpx_code_type;\n+\t\t\t\txfree($4);\n \t\t\t}\n \t\t\t|\tWITH\tTCP\tRESET\n \t\t\t{\n@@ -2392,6 +2410,7 @@ variable_expr\t\t:\t'$'\tidentifier\n \t\t\t\tif (symbol_lookup(scope, $2) == NULL) {\n \t\t\t\t\terec_queue(error(&@2, \"unknown identifier '%s'\", $2),\n \t\t\t\t\t\t   state->msgs);\n+\t\t\t\t\txfree($2);\n \t\t\t\t\tYYERROR;\n \t\t\t\t}\n \n@@ -2692,6 +2711,7 @@ quota_config\t\t:\tquota_mode NUM quota_unit quota_used\n \t\t\t\tuint64_t rate;\n \n \t\t\t\terec = data_unit_parse(&@$, $3, &rate);\n+\t\t\t\txfree($3);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -2994,6 +3014,7 @@ meta_expr\t\t:\tMETA\tmeta_key\n \t\t\t\tunsigned int key;\n \n \t\t\t\terec = meta_key_parse(&@$, $2, &key);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -3046,6 +3067,7 @@ meta_stmt\t\t:\tMETA\tmeta_key\tSET\texpr\n \t\t\t\tunsigned int key;\n \n \t\t\t\terec = meta_key_parse(&@$, $2, &key);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -3110,6 +3132,7 @@ ct_expr\t\t\t: \tCT\tct_key\n \t\t\t\tunsigned int key;\n \n \t\t\t\terec = ct_key_parse(&@$, $2, &key);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -3123,6 +3146,7 @@ ct_expr\t\t\t: \tCT\tct_key\n \t\t\t\tint8_t direction;\n \n \t\t\t\terec = ct_dir_parse(&@$, $2, &direction);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -3180,6 +3204,7 @@ ct_stmt\t\t\t:\tCT\tct_key\t\tSET\texpr\n \t\t\t\tunsigned int key;\n \n \t\t\t\terec = ct_key_parse(&@$, $2, &key);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\n@@ -3202,6 +3227,7 @@ ct_stmt\t\t\t:\tCT\tct_key\t\tSET\texpr\n \t\t\t\tint8_t direction;\n \n \t\t\t\terec = ct_dir_parse(&@$, $2, &direction);\n+\t\t\t\txfree($2);\n \t\t\t\tif (erec != NULL) {\n \t\t\t\t\terec_queue(erec, state->msgs);\n \t\t\t\t\tYYERROR;\ndiff --git a/src/rule.c b/src/rule.c\nindex 140855f517571..44d36c16ea47f 100644\n--- a/src/rule.c\n+++ b/src/rule.c\n@@ -926,6 +926,7 @@ struct monitor *monitor_alloc(uint32_t format, uint32_t type, const char *event)\n \n void monitor_free(struct monitor *m)\n {\n+\txfree(m->event);\n \txfree(m);\n }\n \n",
    "prefixes": [
        "nft"
    ]
}