Don't check g_free() arguments for NULL.
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 26 Mar 2015 20:51:37 +0000 (21:51 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 26 Mar 2015 23:11:21 +0000 (00:11 +0100)
The g_free() call is guaranteed to not segfault when NULL is passed.

decode.c
session.c

index cadd5ea74807092a6e2e1ec652403057f7b04db8..4d584d73b87ea3439bbf744f68811f14d2d8c6ac 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -198,8 +198,7 @@ int register_pds(const char *opt_pds, char *opt_pd_annotations)
                g_hash_table_destroy(options);
        if (channels)
                g_hash_table_destroy(channels);
-       if (pd_name)
-               g_free(pd_name);
+       g_free(pd_name);
 
        return ret;
 }
index 30e08252fe6543b94a266fe92b708332bfe01f17..86eea7c44b462b10dbe9a83cc038d9c7ddc0b04c 100644 (file)
--- a/session.c
+++ b/session.c
@@ -332,8 +332,7 @@ void datafeed_in(const struct sr_dev_inst *sdi,
 
                if (o) {
                        sr_output_free(o);
-                       if (srzip_and_filename)
-                               g_free(srzip_and_filename);
+                       g_free(srzip_and_filename);
                }
                o = NULL;