mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
gst/gstindex.*: Don't free key strings which we don't own. Fixes crash in gst_index_entry_free() (#522741).
Original commit message from CVS: * gst/gstindex.c: (gst_index_entry_free): * gst/gstindex.h: Don't free key strings which we don't own. Fixes crash in gst_index_entry_free() (#522741). * tests/check/Makefile.am: * tests/check/gst/.cvsignore: * tests/check/gst/gstindex.c: (test_index_entries), (gst_index_suite), (gst_index): Add unit test for the above.
This commit is contained in:
parent
567f929b8c
commit
ede8ee12bb
6 changed files with 75 additions and 9 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2008-03-17 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/gstindex.c: (gst_index_entry_free):
|
||||||
|
* gst/gstindex.h:
|
||||||
|
Don't free key strings which we don't own. Fixes crash in
|
||||||
|
gst_index_entry_free() (#522741).
|
||||||
|
|
||||||
|
* tests/check/Makefile.am:
|
||||||
|
* tests/check/gst/.cvsignore:
|
||||||
|
* tests/check/gst/gstindex.c: (test_index_entries),
|
||||||
|
(gst_index_suite), (gst_index):
|
||||||
|
Add unit test for the above.
|
||||||
|
|
||||||
2008-03-11 Sebastian Dröge <slomo@circular-chaos.org>
|
2008-03-11 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* win32/common/libgstreamer.def:
|
* win32/common/libgstreamer.def:
|
||||||
|
|
|
@ -545,16 +545,8 @@ gst_index_entry_free (GstIndexEntry * entry)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_INDEX_ENTRY_OBJECT:
|
case GST_INDEX_ENTRY_OBJECT:
|
||||||
if (entry->data.object.key) {
|
|
||||||
g_free (entry->data.object.key);
|
|
||||||
entry->data.object.key = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GST_INDEX_ENTRY_FORMAT:
|
case GST_INDEX_ENTRY_FORMAT:
|
||||||
if (entry->data.format.key) {
|
|
||||||
g_free (entry->data.format.key);
|
|
||||||
entry->data.format.key = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ struct _GstIndexEntry {
|
||||||
} object;
|
} object;
|
||||||
struct {
|
struct {
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gchar *key;
|
const gchar *key;
|
||||||
} format;
|
} format;
|
||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,7 @@ REGISTRY_CHECKS = \
|
||||||
gst/gstelement \
|
gst/gstelement \
|
||||||
gst/gstevent \
|
gst/gstevent \
|
||||||
gst/gstghostpad \
|
gst/gstghostpad \
|
||||||
|
gst/gstindex \
|
||||||
gst/gstinterface \
|
gst/gstinterface \
|
||||||
gst/gstplugin \
|
gst/gstplugin \
|
||||||
gst/gstquery \
|
gst/gstquery \
|
||||||
|
|
1
tests/check/gst/.gitignore
vendored
1
tests/check/gst/.gitignore
vendored
|
@ -10,6 +10,7 @@ gstelement
|
||||||
gstevent
|
gstevent
|
||||||
gstghostpad
|
gstghostpad
|
||||||
gstiterator
|
gstiterator
|
||||||
|
gstindex
|
||||||
gstinterface
|
gstinterface
|
||||||
gstmessage
|
gstmessage
|
||||||
gstminiobject
|
gstminiobject
|
||||||
|
|
59
tests/check/gst/gstindex.c
Normal file
59
tests/check/gst/gstindex.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/* GStreamer GstIndex unit test
|
||||||
|
* Copyright (C) 2008 Tim-Philipp Müller <tim centricular net>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
GST_START_TEST (test_index_entries)
|
||||||
|
{
|
||||||
|
GstIndexEntry *entry;
|
||||||
|
GstElement *pipe;
|
||||||
|
GstIndex *index;
|
||||||
|
gint id = -1;
|
||||||
|
|
||||||
|
pipe = gst_pipeline_new ("pipeline");
|
||||||
|
|
||||||
|
index = gst_index_new ();
|
||||||
|
fail_unless (gst_index_get_writer_id (index, GST_OBJECT (pipe), &id));
|
||||||
|
|
||||||
|
entry = gst_index_add_format (index, id, GST_FORMAT_BYTES);
|
||||||
|
gst_index_entry_free (entry);
|
||||||
|
|
||||||
|
gst_object_unref (index);
|
||||||
|
gst_object_unref (pipe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
static Suite *
|
||||||
|
gst_index_suite (void)
|
||||||
|
{
|
||||||
|
Suite *s = suite_create ("GstIndex");
|
||||||
|
TCase *tc_chain = tcase_create ("general");
|
||||||
|
|
||||||
|
suite_add_tcase (s, tc_chain);
|
||||||
|
tcase_add_test (tc_chain, test_index_entries);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_CHECK_MAIN (gst_index);
|
Loading…
Reference in a new issue