c
1 static int qca_read_fw_build_info(struct hci_dev *hdev) {
2     char cmd, *build_label = NULL;
3     int data_len = get_firmware_build_info(hdev, NULL); // Get size first
4     if (data_len > 0) {
5         build_label = malloc(data_len + 1); // Allocate memory
6         if (!build_label) {
7             // Handle allocation error
8             return -1; 
9         }
10         get_firmware_build_info(hdev, build_label); 
11     } 
12     // ... use build_label ...
13     free(build_label); // Free allocated memory
14     return 0;
15 }
