diff options
| author | Andreas Steffen <andreas.steffen@strongswan.org> | 2017-05-29 09:59:20 +0200 |
|---|---|---|
| committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2017-05-29 10:59:22 +0200 |
| commit | 89f05ed5a963acfe3da074d734527bac3bb23ac5 (patch) | |
| tree | f96c834c20ff85c7bba515ef86e3334d9df5d9db /src/libimcv/plugins | |
| parent | 29e1c586430c5f75a41d18cd344f39ad8d027000 (diff) | |
| download | strongswan-89f05ed5a963acfe3da074d734527bac3bb23ac5.tar.bz2 strongswan-89f05ed5a963acfe3da074d734527bac3bb23ac5.tar.xz | |
imv-swid: Fixed memory leak in http REST interface
Diffstat (limited to 'src/libimcv/plugins')
| -rw-r--r-- | src/libimcv/plugins/imv_swid/imv_swid_rest.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/libimcv/plugins/imv_swid/imv_swid_rest.c b/src/libimcv/plugins/imv_swid/imv_swid_rest.c index 143b0b239..0fe96edef 100644 --- a/src/libimcv/plugins/imv_swid/imv_swid_rest.c +++ b/src/libimcv/plugins/imv_swid/imv_swid_rest.c @@ -70,27 +70,29 @@ METHOD(imv_swid_rest_t, post, status_t, FETCH_END); free(uri); - if (status == SUCCESS) + if (status != SUCCESS) { - return SUCCESS; - } - - if (code != HTTP_STATUS_CODE_PRECONDITION_FAILED || !response.ptr) - { - DBG2(DBG_IMV, "REST http request failed with status code: %d", code); - return FAILED; - } - - if (jresponse) - { - /* Parse HTTP response into a JSON object */ - tokener = json_tokener_new(); - *jresponse = json_tokener_parse_ex(tokener, response.ptr, response.len); - json_tokener_free(tokener); + if (code != HTTP_STATUS_CODE_PRECONDITION_FAILED || !response.ptr) + { + DBG2(DBG_IMV, "REST http request failed with status code: %d", code); + status = FAILED; + } + else + { + if (jresponse) + { + /* Parse HTTP response into a JSON object */ + tokener = json_tokener_new(); + *jresponse = json_tokener_parse_ex(tokener, response.ptr, + response.len); + json_tokener_free(tokener); + } + status = NEED_MORE; + } } free(response.ptr); - return NEED_MORE; + return status; } METHOD(imv_swid_rest_t, destroy, void, |
