From: Stefan Kost Date: Thu, 10 Apr 2008 14:10:51 +0000 (+0000) Subject: gst/gstpad.c: Do not abort on out of memory for pad_alloc_buffer. X-Git-Tag: RELEASE-0_10_20~147 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbbdcf5dd3af56db55c7bafbf96aedc80f014ce0;p=platform%2Fupstream%2Fgstreamer.git gst/gstpad.c: Do not abort on out of memory for pad_alloc_buffer. Original commit message from CVS: * gst/gstpad.c: Do not abort on out of memory for pad_alloc_buffer. --- diff --git a/ChangeLog b/ChangeLog index 587c84f..1363b6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-04-10 Stefan Kost + * gst/gstpad.c: + Do not abort on out of memory for pad_alloc_buffer. + +2008-04-10 Stefan Kost + * libs/gst/check/gstcheck.c: Remove blank line between symbol name ad parameters to fix gtkdoc warning. diff --git a/gst/gstpad.c b/gst/gstpad.c index 9458321..c423252 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2699,11 +2699,15 @@ fallback: /* fallback case, allocate a buffer of our own, add pad caps. */ GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "fallback buffer alloc"); - *buf = gst_buffer_new_and_alloc (size); - GST_BUFFER_OFFSET (*buf) = offset; - gst_buffer_set_caps (*buf, caps); - - return GST_FLOW_OK; + if ((*buf = gst_buffer_try_new_and_alloc (size))) { + GST_BUFFER_OFFSET (*buf) = offset; + gst_buffer_set_caps (*buf, caps); + return GST_FLOW_OK; + } else { + GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, + "out of memory allocating %d bytes", size); + return GST_FLOW_ERROR; + } } }