Commit 2b4274d6 authored by Elias Naur's avatar Elias Naur

runtime/cgo: CFRelease result from CFBundleCopyResourceURL

The result from CFBundleCopyResourceURL is owned by the caller. This
CL adds the necessary CFRelease to release it after use.

Fixes #19722

Change-Id: I7afe22ef241d21922a7f5cef6498017e6269a5c3
Reviewed-on: https://go-review.googlesource.com/38639
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
parent f9783011
......@@ -108,7 +108,9 @@ init_working_dir()
}
CFStringRef url_str_ref = CFURLGetString(url_ref);
char buf[MAXPATHLEN];
if (!CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8)) {
Boolean res = CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8);
CFRelease(url_ref);
if (!res) {
fprintf(stderr, "runtime/cgo: cannot get URL string\n");
return;
}
......
......@@ -110,7 +110,9 @@ init_working_dir()
}
CFStringRef url_str_ref = CFURLGetString(url_ref);
char buf[MAXPATHLEN];
if (!CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8)) {
Boolean res = CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8);
CFRelease(url_ref);
if (!res) {
fprintf(stderr, "runtime/cgo: cannot get URL string\n");
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment