summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2015-11-15 02:58:54 -0800
committerReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2015-11-17 14:50:27 -0800
commit0c95b0a738eda526241fc16a7cf12106baa3bf82 (patch)
treeeb1b609d6265875878c8659c5ea7bc931b08c1c1
parent5f79ccb420d6b270d108892f1c7e3dedbd64b57a (diff)
Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
-rw-r--r--gst-libs/gst/pbutils/encoding-profile.c24
-rw-r--r--gst-libs/gst/pbutils/encoding-target.c30
-rw-r--r--gst-libs/gst/rtsp/gstrtspmessage.c3
-rw-r--r--gst-libs/gst/sdp/gstsdpmessage.c3
-rw-r--r--tests/examples/encoding/encoding.c9
5 files changed, 23 insertions, 46 deletions
diff --git a/gst-libs/gst/pbutils/encoding-profile.c b/gst-libs/gst/pbutils/encoding-profile.c
index ee308e591..9d28ce91a 100644
--- a/gst-libs/gst/pbutils/encoding-profile.c
+++ b/gst-libs/gst/pbutils/encoding-profile.c
@@ -292,18 +292,14 @@ static void
gst_encoding_profile_finalize (GObject * object)
{
GstEncodingProfile *prof = (GstEncodingProfile *) object;
- if (prof->name)
- g_free (prof->name);
+ g_free (prof->name);
if (prof->format)
gst_caps_unref (prof->format);
- if (prof->preset)
- g_free (prof->preset);
- if (prof->description)
- g_free (prof->description);
+ g_free (prof->preset);
+ g_free (prof->description);
if (prof->restriction)
gst_caps_unref (prof->restriction);
- if (prof->preset_name)
- g_free (prof->preset_name);
+ g_free (prof->preset_name);
}
static void
@@ -443,8 +439,7 @@ gst_encoding_profile_get_restriction (GstEncodingProfile * profile)
void
gst_encoding_profile_set_name (GstEncodingProfile * profile, const gchar * name)
{
- if (profile->name)
- g_free (profile->name);
+ g_free (profile->name);
profile->name = g_strdup (name);
}
@@ -460,8 +455,7 @@ void
gst_encoding_profile_set_description (GstEncodingProfile * profile,
const gchar * description)
{
- if (profile->description)
- g_free (profile->description);
+ g_free (profile->description);
profile->description = g_strdup (description);
}
@@ -522,8 +516,7 @@ void
gst_encoding_profile_set_preset (GstEncodingProfile * profile,
const gchar * preset)
{
- if (profile->preset)
- g_free (profile->preset);
+ g_free (profile->preset);
profile->preset = g_strdup (preset);
}
@@ -538,8 +531,7 @@ void
gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
const gchar * preset_name)
{
- if (profile->preset_name)
- g_free (profile->preset_name);
+ g_free (profile->preset_name);
profile->preset_name = g_strdup (preset_name);
}
diff --git a/gst-libs/gst/pbutils/encoding-target.c b/gst-libs/gst/pbutils/encoding-target.c
index 4c067a507..bd5a3b3fe 100644
--- a/gst-libs/gst/pbutils/encoding-target.c
+++ b/gst-libs/gst/pbutils/encoding-target.c
@@ -104,12 +104,9 @@ gst_encoding_target_finalize (GObject * object)
GST_DEBUG ("Finalizing");
- if (target->name)
- g_free (target->name);
- if (target->category)
- g_free (target->category);
- if (target->description)
- g_free (target->description);
+ g_free (target->name);
+ g_free (target->category);
+ g_free (target->description);
g_list_foreach (target->profiles, (GFunc) g_object_unref, NULL);
g_list_free (target->profiles);
@@ -655,14 +652,10 @@ parse_encoding_profile (GKeyFile * in, gchar * parentprofilename,
if (formatcaps)
gst_caps_unref (formatcaps);
- if (pname)
- g_free (pname);
- if (description)
- g_free (description);
- if (preset)
- g_free (preset);
- if (proftype)
- g_free (proftype);
+ g_free (pname);
+ g_free (description);
+ g_free (preset);
+ g_free (proftype);
return sprof;
}
@@ -690,12 +683,9 @@ parse_keyfile (GKeyFile * in, gchar * targetname, gchar * categoryname,
g_strfreev (groups);
- if (targetname)
- g_free (targetname);
- if (categoryname)
- g_free (categoryname);
- if (description)
- g_free (description);
+ g_free (targetname);
+ g_free (categoryname);
+ g_free (description);
return res;
}
diff --git a/gst-libs/gst/rtsp/gstrtspmessage.c b/gst-libs/gst/rtsp/gstrtspmessage.c
index a326e5af1..99eec2efb 100644
--- a/gst-libs/gst/rtsp/gstrtspmessage.c
+++ b/gst-libs/gst/rtsp/gstrtspmessage.c
@@ -863,8 +863,7 @@ gst_rtsp_message_take_body (GstRTSPMessage * msg, guint8 * data, guint size)
g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
g_return_val_if_fail (data != NULL || size == 0, GST_RTSP_EINVAL);
- if (msg->body)
- g_free (msg->body);
+ g_free (msg->body);
msg->body = data;
msg->body_size = size;
diff --git a/gst-libs/gst/sdp/gstsdpmessage.c b/gst-libs/gst/sdp/gstsdpmessage.c
index 1259459b6..0bd235cc4 100644
--- a/gst-libs/gst/sdp/gstsdpmessage.c
+++ b/gst-libs/gst/sdp/gstsdpmessage.c
@@ -3016,8 +3016,7 @@ gst_sdp_message_parse_buffer (const guint8 * data, guint size,
#undef SIZE_CHECK_GUARD
out:
- if (buffer)
- g_free (buffer);
+ g_free (buffer);
return GST_SDP_OK;
}
diff --git a/tests/examples/encoding/encoding.c b/tests/examples/encoding/encoding.c
index 83820b7a1..a7f80afa4 100644
--- a/tests/examples/encoding/encoding.c
+++ b/tests/examples/encoding/encoding.c
@@ -55,8 +55,7 @@ list_codecs (void)
desc = gst_pb_utils_get_codec_description (caps);
g_print (" %s - %s\n", desc, tmpstr);
g_free (tmpstr);
- if (desc)
- g_free (desc);
+ g_free (desc);
gst_caps_remove_structure (caps, 0);
}
g_print ("\n");
@@ -73,8 +72,7 @@ list_codecs (void)
desc = gst_pb_utils_get_codec_description (caps);
g_print (" %s - %s\n", desc, tmpstr);
g_free (tmpstr);
- if (desc)
- g_free (desc);
+ g_free (desc);
gst_caps_remove_structure (caps, 0);
}
g_print ("\n");
@@ -91,8 +89,7 @@ list_codecs (void)
desc = gst_pb_utils_get_codec_description (caps);
g_print (" %s - %s\n", desc, tmpstr);
g_free (tmpstr);
- if (desc)
- g_free (desc);
+ g_free (desc);
gst_caps_remove_structure (caps, 0);
}
g_print ("\n");