mac-capture: Don't call CFRelease on null vars

CFRelease is not meant to be used with null variables.  Check the
variables before calling CFRelease.
This commit is contained in:
jp9000 2015-08-03 00:08:03 -07:00
parent ff0c58e963
commit 05eef74891
2 changed files with 10 additions and 4 deletions

View File

@ -62,8 +62,10 @@ static bool coreaudio_enum_device(enum_device_proc_t proc, void *param,
enum_next = proc(param, cf_name, cf_uid, id);
fail:
CFRelease(cf_name);
CFRelease(cf_uid);
if (cf_name)
CFRelease(cf_name);
if (cf_uid)
CFRelease(cf_uid);
return enum_next;
}

View File

@ -113,7 +113,9 @@ static bool find_device_id_by_uid(struct coreaudio_data *ca)
success = coreaudio_get_device_id(cf_uid, &ca->device_id);
}
CFRelease(cf_uid);
if (cf_uid)
CFRelease(cf_uid);
return success;
}
@ -502,7 +504,9 @@ static bool coreaudio_get_device_name(struct coreaudio_data *ca)
bfree(ca->device_name);
ca->device_name = bstrdup(name);
CFRelease(cf_name);
if (cf_name)
CFRelease(cf_name);
return true;
}