* [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem.
@ 2011-03-06 0:36 Michael Snyder
2011-03-06 7:45 ` Alan Modra
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2011-03-06 0:36 UTC (permalink / raw)
To: gdb-patches, binutils, H.J. Lu
[-- Attachment #1: Type: text/plain, Size: 58 bytes --]
Fail gracefully if not enough memory for operation.
OK?
[-- Attachment #2: compress.txt --]
[-- Type: text/plain, Size: 801 bytes --]
2011-03-05 Michael Snyder <msnyder@vmware.com>
* compress.c (bfd_compress_section_contents): Check for out of mem.
Index: compress.c
===================================================================
RCS file: /cvs/src/src/bfd/compress.c,v
retrieving revision 1.7
diff -u -p -r1.7 compress.c
--- compress.c 24 Dec 2010 10:40:19 -0000 1.7
+++ compress.c 6 Mar 2011 00:32:01 -0000
@@ -100,6 +100,12 @@ bfd_compress_section_contents (bfd *abfd
compressed_size = compressBound (uncompressed_size) + 12;
compressed_buffer = (bfd_byte *) bfd_malloc (compressed_size);
+ if (compressed_buffer == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+
if (compress ((Bytef*) compressed_buffer + 12,
&compressed_size,
(const Bytef*) uncompressed_buffer,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem.
2011-03-06 0:36 [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem Michael Snyder
@ 2011-03-06 7:45 ` Alan Modra
2011-03-06 18:37 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2011-03-06 7:45 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, binutils, H.J. Lu
On Sat, Mar 05, 2011 at 04:36:07PM -0800, Michael Snyder wrote:
> * compress.c (bfd_compress_section_contents): Check for out of mem.
Just return FALSE. No need to bfd_set_error, that will already be
done in bfd_malloc. OK with that change.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem.
2011-03-06 7:45 ` Alan Modra
@ 2011-03-06 18:37 ` Michael Snyder
0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2011-03-06 18:37 UTC (permalink / raw)
To: Michael Snyder, gdb-patches, binutils, H.J. Lu
Alan Modra wrote:
> On Sat, Mar 05, 2011 at 04:36:07PM -0800, Michael Snyder wrote:
>> * compress.c (bfd_compress_section_contents): Check for out of mem.
>
> Just return FALSE. No need to bfd_set_error, that will already be
> done in bfd_malloc. OK with that change.
>
Done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-06 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-06 0:36 [RFA] bfd, compress.c (bfd_compress_section_contents): Check for out of mem Michael Snyder
2011-03-06 7:45 ` Alan Modra
2011-03-06 18:37 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).