Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Firebase/DynamicLinks/Utilities/FDLUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,16 @@ BOOL FIRDLOSVersionSupported(NSString *_Nullable systemVersion, NSString *minSup
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = calloc(1, size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
machineString = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
free(machine);

// compute string size
if (sysctlbyname("hw.machine", NULL, &size, NULL, 0) == 0) {
// get device name
char *machine = calloc(1, size);
if (sysctlbyname("hw.machine", machine, &size, NULL, 0) == 0) {
machineString = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
}
free(machine);
}
});
return machineString;
}
Expand Down