Przeglądaj źródła

local-ctrl: fix memory allocation issues found by static analyser

David Cermak 5 lat temu
rodzic
commit
49e8c09ec2

+ 1 - 1
components/esp_local_ctrl/src/esp_local_ctrl_handler.c

@@ -214,7 +214,7 @@ static void esp_local_ctrl_command_cleanup(LocalCtrlMessage *resp, void **ctx)
                 if (resp->resp_get_prop_vals) {
                     prop_val_free_fn_t *free_fns = (prop_val_free_fn_t *)(*ctx);
                     for (size_t i = 0; i < resp->resp_get_prop_vals->n_props; i++) {
-                        if (free_fns[i]) {
+                        if (free_fns && free_fns[i]) {
                             free_fns[i](resp->resp_get_prop_vals->props[i]->value.data);
                         }
                         free(resp->resp_get_prop_vals->props[i]);