memory: add check for writablity in resize
authorPrashant Gotarne <ps.gotarne@samsung.com>
Mon, 6 Apr 2015 04:48:15 +0000 (10:18 +0530)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 6 Apr 2015 12:32:20 +0000 (13:32 +0100)
Add guard to gst_memory_resize() to make sure the
memory to be resized is actually writable.

https://bugzilla.gnome.org/show_bug.cgi?id=747392

gst/gstmemory.c

index 36259fc..3505ac2 100644 (file)
@@ -197,6 +197,7 @@ void
 gst_memory_resize (GstMemory * mem, gssize offset, gsize size)
 {
   g_return_if_fail (mem != NULL);
+  g_return_if_fail (gst_memory_is_writable (mem));
   g_return_if_fail (offset >= 0 || mem->offset >= -offset);
   g_return_if_fail (size + mem->offset + offset <= mem->maxsize);