/* All digit started node should be instances. */
                if (trace_boot_compose_hist_cmd(node, buf, size) == 0) {
                        tmp = kstrdup(buf, GFP_KERNEL);
+                       if (!tmp)
+                               return;
                        if (trigger_process_regex(file, buf) < 0)
                                pr_err("Failed to apply hist trigger: %s\n", tmp);
                        kfree(tmp);
        if (xbc_node_find_subkey(hnode, "keys")) {
                if (trace_boot_compose_hist_cmd(hnode, buf, size) == 0) {
                        tmp = kstrdup(buf, GFP_KERNEL);
+                       if (!tmp)
+                               return;
                        if (trigger_process_regex(file, buf) < 0)
                                pr_err("Failed to apply hist trigger: %s\n", tmp);
                        kfree(tmp);