Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153763349
D13917.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D13917.diff
View Options
Index: head/stand/efi/libefi/efichar.c
===================================================================
--- head/stand/efi/libefi/efichar.c
+++ head/stand/efi/libefi/efichar.c
@@ -116,8 +116,10 @@
if (len >= sz) {
/* Absent bugs, we'll never return EOVERFLOW */
- if (freeit)
+ if (freeit) {
free(*name);
+ *name = NULL;
+ }
return (EOVERFLOW);
}
*cp++ = '\0';
@@ -150,11 +152,8 @@
*/
if ((c & 0xc0) != 0x80) {
/* Initial characters. */
- if (bytes != 0) {
- if (freeit)
- free(nm);
- return (EILSEQ);
- }
+ if (bytes != 0)
+ goto ilseq;
if ((c & 0xf8) == 0xf0) {
ucs4 = c & 0x07;
bytes = 3;
@@ -173,29 +172,31 @@
if (bytes > 0) {
ucs4 = (ucs4 << 6) + (c & 0x3f);
bytes--;
- } else if (bytes == 0) {
- if (freeit)
- free(nm);
- return (EILSEQ);
- }
+ } else if (bytes == 0)
+ goto ilseq;
}
if (bytes == 0) {
- if (ucs4 > 0xffff) {
- if (freeit)
- free(nm);
- return (EILSEQ);
- }
+ if (ucs4 > 0xffff)
+ goto ilseq;
*nm++ = (efi_char)ucs4;
sz -= 2;
}
}
if (sz < 2) {
- if (freeit)
+ if (freeit) {
free(nm);
+ *nmp = NULL;
+ }
return (EDOOFUS);
}
sz -= 2;
*nm = 0;
*len -= sz;
return (0);
+ilseq:
+ if (freeit) {
+ free(nm);
+ *nmp = NULL;
+ }
+ return (EILSEQ);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 24, 1:01 PM (10 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32073587
Default Alt Text
D13917.diff (1 KB)
Attached To
Mode
D13917: When returning an error and freeing allocated memory from ucs2_to_utf8 and utf8_to_ucs2, be sure to NULL out the return pointer too, rather than return a pointer to free memory.
Attached
Detach File
Event Timeline
Log In to Comment