ObjFW  Check-in [48309788c8]

Overview
Comment:Fix a memory leak in OFString that occours when we're out of memory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 48309788c8b2e1b8da513b75cd143a5669672b16404f918b55da6ac0e315a829
User & Date: js on 2009-02-28 01:49:51
Other Links: manifest | tags
Context
2009-03-04
20:49
- release should not be chained, might be free'd. Therefore return void. check-in: e73e76e40f user: js tags: trunk
2009-02-28
01:49
Fix a memory leak in OFString that occours when we're out of memory. check-in: 48309788c8 user: js tags: trunk
2009-02-27
12:31
(void)initialize -> initialize. check-in: 3b62c10b6f user: js tags: trunk
Changes

Modified src/OFString.m from [504b483064] to [365ef7f711].

159
160
161
162
163
164
165

166




167
168
169
170
171
172
173
			case -1:
				c = [self class];
				[super free];
				@throw [OFInvalidEncodingException
				    newWithClass: c];
			}


			string = [self getMemWithSize: length + 1];




			memcpy(string, str, length + 1);
		}
	}

	return self;
}








>
|
>
>
>
>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
			case -1:
				c = [self class];
				[super free];
				@throw [OFInvalidEncodingException
				    newWithClass: c];
			}

			@try {
				string = [self getMemWithSize: length + 1];
			} @catch (OFException *e) {
				[self free];
				@throw e;
			}
			memcpy(string, str, length + 1);
		}
	}

	return self;
}