Closed lordgamez closed 2 years ago
cc @ityuhui
I think this is a bug in the generated code. The function is free-ing the list metadata here:
but any-place that goto end
is called, metadata_local_nonprim
hasn't been initialized yet.
We should either initialize that to NULL
at the top of the generated function, or remove that free code.
I think the right thing to do is to remove the free code, since it doesn't appear to be being used.
OK. I'll look at this code soon.
Some additional information on this is that I had the same problem with CoreV1API_listNamespace
call, so the problem is not specific to listing pods.
Thank you for reporting this issue @lordgamez
I believe that you need to add a section here:
That looks like:
{{#vars}}
{{^isPrimitiveType}}
{{#isModel}}
{{^isEnum}}
{{^isFreeFormObject}}{{complexType}}{{/isFreeFormObject}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_t *{{name}}_local_nonprim = NULL;
{{/isEnum}}
{{/isModel}}
{{/vars}}
And then remove the line here: https://github.com/OpenAPITools/openapi-generator/blob/bd8efe2f91761df866489c16e1c17870a8c88c5f/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache#L617
Hope that helps.
Thanks for the help! Although I don't have any experience with OpenAPI, can you point me to some documentation how to generate the API code?
@lordgamez
I'll fix this issue according to @brendandburns' suggestion. You don't need generate the API code by yourself unless you want to have a try. The guide can be found at https://github.com/kubernetes-client/c/issues/61#issuecomment-889596858
Thanks @ityuhui, sorry I thought the comment was directed at me :) Still I'll check out the guide just for fun. :)
The upstream openapi-generator breaks the generating for C client recently. Now I'm checking that issue https://github.com/OpenAPITools/openapi-generator/issues/10725.
Hi Team,
I was trying to run the list_pod_incluster in a kind kubernetes cluster from inside a pod, but it crashed with segmentation fault with the following backtrace:
When removing the
v1_list_meta_free
call from thev1_pod_list_parseFromJSON
function I get the output:I do not have permission currently for running cluster level commands with the default service account I was using, so this looks okay, but the crash should not happen.