Commit 68e66816 authored by Reynaldo H. Verdejo Pinochet's avatar Reynaldo H. Verdejo Pinochet Committed by Tim-Philipp Müller

Remove unnecessary NULL checks before g_free()

g_free() is NULL-safe
parent c9fafe84
......@@ -329,8 +329,7 @@ gst_gl_bumper_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_LOCATION:
if (bumper->location != NULL)
g_free (bumper->location);
g_free (bumper->location);
bumper->location = g_value_dup_string (value);
break;
default:
......
......@@ -236,8 +236,7 @@ gst_gl_differencematte_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_LOCATION:
if (differencematte->location != NULL)
g_free (differencematte->location);
g_free (differencematte->location);
differencematte->bg_has_changed = TRUE;
differencematte->location = g_value_dup_string (value);
break;
......
......@@ -164,12 +164,10 @@ gst_gl_filtershader_finalize (GObject * object)
{
GstGLFilterShader *filtershader = GST_GL_FILTERSHADER (object);
if (filtershader->vertex)
g_free (filtershader->vertex);
g_free (filtershader->vertex);
filtershader->vertex = NULL;
if (filtershader->fragment)
g_free (filtershader->fragment);
g_free (filtershader->fragment);
filtershader->fragment = NULL;
if (filtershader->uniforms)
......@@ -195,16 +193,14 @@ gst_gl_filtershader_set_property (GObject * object, guint prop_id,
break;
case PROP_VERTEX:
GST_OBJECT_LOCK (filtershader);
if (filtershader->vertex)
g_free (filtershader->vertex);
g_free (filtershader->vertex);
filtershader->vertex = g_value_dup_string (value);
filtershader->new_source = TRUE;
GST_OBJECT_UNLOCK (filtershader);
break;
case PROP_FRAGMENT:
GST_OBJECT_LOCK (filtershader);
if (filtershader->fragment)
g_free (filtershader->fragment);
g_free (filtershader->fragment);
filtershader->fragment = g_value_dup_string (value);
filtershader->new_source = TRUE;
GST_OBJECT_UNLOCK (filtershader);
......
......@@ -277,8 +277,7 @@ gst_gl_overlay_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_LOCATION:
if (overlay->location != NULL)
g_free (overlay->location);
g_free (overlay->location);
overlay->location_has_changed = TRUE;
overlay->location = g_value_dup_string (value);
break;
......
......@@ -189,8 +189,7 @@ _gst_gl_feature_check (GstGLContext * context,
for (func_num = 0; data->functions[func_num].name; func_num++) {
void *func;
if (full_function_name)
g_free (full_function_name);
g_free (full_function_name);
full_function_name = g_strconcat ("gl", data->functions[func_num].name,
suffix, NULL);
......
......@@ -312,8 +312,7 @@ gst_glsl_stage_set_strings (GstGLSLStage * stage, GstGLSLVersion version,
if (stage->priv->n_strings < n_strings) {
/* only realloc if we need more space */
if (stage->priv->strings)
g_free (stage->priv->strings);
g_free (stage->priv->strings);
stage->priv->strings = g_new0 (gchar *, n_strings);
}
......
......@@ -461,8 +461,7 @@ gst_gl_context_set_error (GstGLContext * context, const char *format, ...)
{
va_list args;
if (error_message)
g_free (error_message);
g_free (error_message);
va_start (args, format);
error_message = g_strdup_vprintf (format, args);
......
......@@ -55,8 +55,7 @@ gst_gl_display_x11_finalize (GObject * object)
{
GstGLDisplayX11 *display_x11 = GST_GL_DISPLAY_X11 (object);
if (display_x11->name)
g_free (display_x11->name);
g_free (display_x11->name);
if (!display_x11->foreign_display && display_x11->display) {
XCloseDisplay (display_x11->display);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment