Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak when a JSON of model fails to parse #47

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webho

return admissionregistration_v1_webhook_client_config_local_var;
end:
if (service_local_nonprim) {
admissionregistration_v1_service_reference_free(service_local_nonprim);
service_local_nonprim = NULL;
}
return NULL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ admissionregistration_v1beta1_webhook_client_config_t *admissionregistration_v1b

return admissionregistration_v1beta1_webhook_client_config_local_var;
end:
if (service_local_nonprim) {
admissionregistration_v1beta1_service_reference_free(service_local_nonprim);
service_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/apiextensions_v1_webhook_client_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config

return apiextensions_v1_webhook_client_config_local_var;
end:
if (service_local_nonprim) {
apiextensions_v1_service_reference_free(service_local_nonprim);
service_local_nonprim = NULL;
}
return NULL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ apiextensions_v1beta1_webhook_client_config_t *apiextensions_v1beta1_webhook_cli

return apiextensions_v1beta1_webhook_client_config_local_var;
end:
if (service_local_nonprim) {
apiextensions_v1beta1_service_reference_free(service_local_nonprim);
service_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/apps_v1beta1_deployment.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ apps_v1beta1_deployment_t *apps_v1beta1_deployment_parseFromJSON(cJSON *apps_v1b

return apps_v1beta1_deployment_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
apps_v1beta1_deployment_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
if (status_local_nonprim) {
apps_v1beta1_deployment_status_free(status_local_nonprim);
status_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/apps_v1beta1_deployment_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ apps_v1beta1_deployment_list_t *apps_v1beta1_deployment_list_parseFromJSON(cJSON

return apps_v1beta1_deployment_list_local_var;
end:
if (metadata_local_nonprim) {
v1_list_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/apps_v1beta1_deployment_rollback.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ apps_v1beta1_deployment_rollback_t *apps_v1beta1_deployment_rollback_parseFromJS

return apps_v1beta1_deployment_rollback_local_var;
end:
if (rollback_to_local_nonprim) {
apps_v1beta1_rollback_config_free(rollback_to_local_nonprim);
rollback_to_local_nonprim = NULL;
}
return NULL;

}
16 changes: 16 additions & 0 deletions kubernetes/model/apps_v1beta1_deployment_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ apps_v1beta1_deployment_spec_t *apps_v1beta1_deployment_spec_parseFromJSON(cJSON

return apps_v1beta1_deployment_spec_local_var;
end:
if (rollback_to_local_nonprim) {
apps_v1beta1_rollback_config_free(rollback_to_local_nonprim);
rollback_to_local_nonprim = NULL;
}
if (selector_local_nonprim) {
v1_label_selector_free(selector_local_nonprim);
selector_local_nonprim = NULL;
}
if (strategy_local_nonprim) {
apps_v1beta1_deployment_strategy_free(strategy_local_nonprim);
strategy_local_nonprim = NULL;
}
if (_template_local_nonprim) {
v1_pod_template_spec_free(_template_local_nonprim);
_template_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/apps_v1beta1_deployment_strategy.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ apps_v1beta1_deployment_strategy_t *apps_v1beta1_deployment_strategy_parseFromJS

return apps_v1beta1_deployment_strategy_local_var;
end:
if (rolling_update_local_nonprim) {
apps_v1beta1_rolling_update_deployment_free(rolling_update_local_nonprim);
rolling_update_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/apps_v1beta1_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ apps_v1beta1_scale_t *apps_v1beta1_scale_parseFromJSON(cJSON *apps_v1beta1_scale

return apps_v1beta1_scale_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
apps_v1beta1_scale_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
if (status_local_nonprim) {
apps_v1beta1_scale_status_free(status_local_nonprim);
status_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/extensions_v1beta1_deployment.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ extensions_v1beta1_deployment_t *extensions_v1beta1_deployment_parseFromJSON(cJS

return extensions_v1beta1_deployment_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
extensions_v1beta1_deployment_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
if (status_local_nonprim) {
extensions_v1beta1_deployment_status_free(status_local_nonprim);
status_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_deployment_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ extensions_v1beta1_deployment_list_t *extensions_v1beta1_deployment_list_parseFr

return extensions_v1beta1_deployment_list_local_var;
end:
if (metadata_local_nonprim) {
v1_list_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_deployment_rollback.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ extensions_v1beta1_deployment_rollback_t *extensions_v1beta1_deployment_rollback

return extensions_v1beta1_deployment_rollback_local_var;
end:
if (rollback_to_local_nonprim) {
extensions_v1beta1_rollback_config_free(rollback_to_local_nonprim);
rollback_to_local_nonprim = NULL;
}
return NULL;

}
16 changes: 16 additions & 0 deletions kubernetes/model/extensions_v1beta1_deployment_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ extensions_v1beta1_deployment_spec_t *extensions_v1beta1_deployment_spec_parseFr

return extensions_v1beta1_deployment_spec_local_var;
end:
if (rollback_to_local_nonprim) {
extensions_v1beta1_rollback_config_free(rollback_to_local_nonprim);
rollback_to_local_nonprim = NULL;
}
if (selector_local_nonprim) {
v1_label_selector_free(selector_local_nonprim);
selector_local_nonprim = NULL;
}
if (strategy_local_nonprim) {
extensions_v1beta1_deployment_strategy_free(strategy_local_nonprim);
strategy_local_nonprim = NULL;
}
if (_template_local_nonprim) {
v1_pod_template_spec_free(_template_local_nonprim);
_template_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_deployment_strategy.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ extensions_v1beta1_deployment_strategy_t *extensions_v1beta1_deployment_strategy

return extensions_v1beta1_deployment_strategy_local_var;
end:
if (rolling_update_local_nonprim) {
extensions_v1beta1_rolling_update_deployment_free(rolling_update_local_nonprim);
rolling_update_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_http_ingress_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ extensions_v1beta1_http_ingress_path_t *extensions_v1beta1_http_ingress_path_par

return extensions_v1beta1_http_ingress_path_local_var;
end:
if (backend_local_nonprim) {
extensions_v1beta1_ingress_backend_free(backend_local_nonprim);
backend_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/extensions_v1beta1_ingress.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ extensions_v1beta1_ingress_t *extensions_v1beta1_ingress_parseFromJSON(cJSON *ex

return extensions_v1beta1_ingress_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
extensions_v1beta1_ingress_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
if (status_local_nonprim) {
extensions_v1beta1_ingress_status_free(status_local_nonprim);
status_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_ingress_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ extensions_v1beta1_ingress_list_t *extensions_v1beta1_ingress_list_parseFromJSON

return extensions_v1beta1_ingress_list_local_var;
end:
if (metadata_local_nonprim) {
v1_list_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_ingress_rule.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ extensions_v1beta1_ingress_rule_t *extensions_v1beta1_ingress_rule_parseFromJSON

return extensions_v1beta1_ingress_rule_local_var;
end:
if (http_local_nonprim) {
extensions_v1beta1_http_ingress_rule_value_free(http_local_nonprim);
http_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_ingress_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ extensions_v1beta1_ingress_spec_t *extensions_v1beta1_ingress_spec_parseFromJSON

return extensions_v1beta1_ingress_spec_local_var;
end:
if (backend_local_nonprim) {
extensions_v1beta1_ingress_backend_free(backend_local_nonprim);
backend_local_nonprim = NULL;
}
return NULL;

}
4 changes: 4 additions & 0 deletions kubernetes/model/extensions_v1beta1_ingress_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ extensions_v1beta1_ingress_status_t *extensions_v1beta1_ingress_status_parseFrom

return extensions_v1beta1_ingress_status_local_var;
end:
if (load_balancer_local_nonprim) {
v1_load_balancer_status_free(load_balancer_local_nonprim);
load_balancer_local_nonprim = NULL;
}
return NULL;

}
8 changes: 8 additions & 0 deletions kubernetes/model/extensions_v1beta1_pod_security_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ extensions_v1beta1_pod_security_policy_t *extensions_v1beta1_pod_security_policy

return extensions_v1beta1_pod_security_policy_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
extensions_v1beta1_pod_security_policy_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
return NULL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ extensions_v1beta1_pod_security_policy_list_t *extensions_v1beta1_pod_security_p

return extensions_v1beta1_pod_security_policy_list_local_var;
end:
if (metadata_local_nonprim) {
v1_list_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
return NULL;

}
24 changes: 24 additions & 0 deletions kubernetes/model/extensions_v1beta1_pod_security_policy_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,30 @@ extensions_v1beta1_pod_security_policy_spec_t *extensions_v1beta1_pod_security_p

return extensions_v1beta1_pod_security_policy_spec_local_var;
end:
if (fs_group_local_nonprim) {
extensions_v1beta1_fs_group_strategy_options_free(fs_group_local_nonprim);
fs_group_local_nonprim = NULL;
}
if (run_as_group_local_nonprim) {
extensions_v1beta1_run_as_group_strategy_options_free(run_as_group_local_nonprim);
run_as_group_local_nonprim = NULL;
}
if (run_as_user_local_nonprim) {
extensions_v1beta1_run_as_user_strategy_options_free(run_as_user_local_nonprim);
run_as_user_local_nonprim = NULL;
}
if (runtime_class_local_nonprim) {
extensions_v1beta1_runtime_class_strategy_options_free(runtime_class_local_nonprim);
runtime_class_local_nonprim = NULL;
}
if (se_linux_local_nonprim) {
extensions_v1beta1_se_linux_strategy_options_free(se_linux_local_nonprim);
se_linux_local_nonprim = NULL;
}
if (supplemental_groups_local_nonprim) {
extensions_v1beta1_supplemental_groups_strategy_options_free(supplemental_groups_local_nonprim);
supplemental_groups_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/extensions_v1beta1_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ extensions_v1beta1_scale_t *extensions_v1beta1_scale_parseFromJSON(cJSON *extens

return extensions_v1beta1_scale_local_var;
end:
if (metadata_local_nonprim) {
v1_object_meta_free(metadata_local_nonprim);
metadata_local_nonprim = NULL;
}
if (spec_local_nonprim) {
extensions_v1beta1_scale_spec_free(spec_local_nonprim);
spec_local_nonprim = NULL;
}
if (status_local_nonprim) {
extensions_v1beta1_scale_status_free(status_local_nonprim);
status_local_nonprim = NULL;
}
return NULL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ extensions_v1beta1_se_linux_strategy_options_t *extensions_v1beta1_se_linux_stra

return extensions_v1beta1_se_linux_strategy_options_local_var;
end:
if (se_linux_options_local_nonprim) {
v1_se_linux_options_free(se_linux_options_local_nonprim);
se_linux_options_local_nonprim = NULL;
}
return NULL;

}
12 changes: 12 additions & 0 deletions kubernetes/model/flowcontrol_v1alpha1_subject.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ flowcontrol_v1alpha1_subject_t *flowcontrol_v1alpha1_subject_parseFromJSON(cJSON

return flowcontrol_v1alpha1_subject_local_var;
end:
if (group_local_nonprim) {
v1alpha1_group_subject_free(group_local_nonprim);
group_local_nonprim = NULL;
}
if (service_account_local_nonprim) {
v1alpha1_service_account_subject_free(service_account_local_nonprim);
service_account_local_nonprim = NULL;
}
if (user_local_nonprim) {
v1alpha1_user_subject_free(user_local_nonprim);
user_local_nonprim = NULL;
}
return NULL;

}
Loading