Remove unnecessary NULL checks before g_free()

g_free() is NULL-safe
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2015-11-17 15:23:17 -08:00 committed by Tim-Philipp Müller
parent c9fafe8445
commit 68e668168d
8 changed files with 11 additions and 22 deletions

View file

@ -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:

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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);