Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/bstream.c @ 17235:1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 22 May 2007 18:56:09 +0000 |
parents | 32c366eeeb99 |
children | 44b4e8bd759b |
comparison
equal
deleted
inserted
replaced
17234:12d0ad970a15 | 17235:1927f4ead3ca |
---|---|
170 | 170 |
171 guint8 *byte_stream_getraw(ByteStream *bs, int len) | 171 guint8 *byte_stream_getraw(ByteStream *bs, int len) |
172 { | 172 { |
173 guint8 *ob; | 173 guint8 *ob; |
174 | 174 |
175 ob = malloc(len); | 175 ob = g_malloc(len); |
176 | 176 |
177 if (byte_stream_getrawbuf(bs, ob, len) < len) { | 177 if (byte_stream_getrawbuf(bs, ob, len) < len) { |
178 free(ob); | 178 g_free(ob); |
179 return NULL; | 179 return NULL; |
180 } | 180 } |
181 | 181 |
182 return ob; | 182 return ob; |
183 } | 183 } |
184 | 184 |
185 char *byte_stream_getstr(ByteStream *bs, int len) | 185 char *byte_stream_getstr(ByteStream *bs, int len) |
186 { | 186 { |
187 char *ob; | 187 char *ob; |
188 | 188 |
189 ob = malloc(len + 1); | 189 ob = g_malloc(len + 1); |
190 | 190 |
191 if (byte_stream_getrawbuf(bs, (guint8 *)ob, len) < len) { | 191 if (byte_stream_getrawbuf(bs, (guint8 *)ob, len) < len) { |
192 free(ob); | 192 g_free(ob); |
193 return NULL; | 193 return NULL; |
194 } | 194 } |
195 | 195 |
196 ob[len] = '\0'; | 196 ob[len] = '\0'; |
197 | 197 |