[dia] [scan-build] Null dereference (theoretical)
- From: Hans Breuer <hans src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dia] [scan-build] Null dereference (theoretical)
- Date: Sun, 6 Dec 2009 19:03:05 +0000 (UTC)
commit 083899ad23176c1a50834038ac13dbbe26e73a55
Author: Hans Breuer <hans breuer org>
Date: Sun Dec 6 18:15:11 2009 +0100
[scan-build] Null dereference (theoretical)
Add g_return_val_if_fail() check to keep scan-build happy.
At least there is no point in calling load or save without data.
app/load_save.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index f545fe6..399faa5 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -402,6 +402,7 @@ diagram_data_load(const char *filename, DiagramData *data, void* user_data)
Layer *active_layer = NULL;
GHashTable* unknown_objects_hash = g_hash_table_new(g_str_hash, g_str_equal);
+ g_return_val_if_fail(data!=NULL, FALSE);
if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
message_error(_("You must specify a file, not a directory.\n"));
@@ -837,6 +838,8 @@ diagram_data_write_doc(DiagramData *data, const char *filename)
xmlNs *name_space;
Diagram *diagram = DIA_IS_DIAGRAM (data) ? DIA_DIAGRAM (data) : NULL;
+ g_return_val_if_fail(data!=NULL, NULL);
+
doc = xmlNewDoc((const xmlChar *)"1.0");
doc->encoding = xmlStrdup((const xmlChar *)"UTF-8");
doc->xmlRootNode = xmlNewDocNode(doc, NULL, (const xmlChar *)"diagram", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]