After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 334113 - Use of uninitialised variable reported by the Coverity checker
Use of uninitialised variable reported by the Coverity checker
Status: RESOLVED FIXED
Product: planner
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: planner-maint
planner-maint
Depends on:
Blocks:
 
 
Reported: 2006-03-10 11:01 UTC by Kjartan Maraas
Modified: 2009-04-07 18:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
My first attempt at fixing these. (5.95 KB, patch)
2006-07-18 00:30 UTC, Lincoln Phipps
none Details | Review

Description Kjartan Maraas 2006-03-10 11:01:37 UTC
1885 	static void
1886 	task_tree_property_data_func (GtkTreeViewColumn *tree_column,
1887 				      GtkCellRenderer   *cell,
1888 				      GtkTreeModel      *tree_model,
1889 				      GtkTreeIter       *iter,
1890 				      gpointer           data)
1891 	{
1892 		MrpObject       *object;
1893 		MrpProperty     *property = data;
1894 		MrpPropertyType  type;

Event var_decl: Declared variable "svalue" without initializer
Also see events: [uninit_arg]

1895 		gchar           *svalue;
1896 		gint             ivalue;
1897 		gfloat           fvalue;
1898 		mrptime          tvalue;
1899 	
1900 		gtk_tree_model_get (tree_model,
1901 				    iter,
1902 				    COL_TASK,
1903 				    &object,
1904 				    -1);
1905 	
1906 		/* FIXME: implement mrp_object_get_property like
1907 		 * g_object_get_property that takes a GValue. 
1908 		 */
1909 		type = mrp_property_get_property_type (property);
1910 	
1911 		switch (type) {
1912 		case MRP_PROPERTY_TYPE_STRING:
1913 			mrp_object_get (object,
1914 					mrp_property_get_name (property), &svalue,
1915 					NULL);
1916 			
1917 			if (svalue == NULL) {
1918 				svalue = g_strdup ("");
1919 			}		
1920 	
1921 			break;
1922 		case MRP_PROPERTY_TYPE_INT:
1923 			mrp_object_get (object,
1924 					mrp_property_get_name (property), &ivalue,
1925 					NULL);
1926 			svalue = g_strdup_printf ("%d", ivalue);
1927 			break;
1928 	
1929 		case MRP_PROPERTY_TYPE_FLOAT:
1930 			mrp_object_get (object,
1931 					mrp_property_get_name (property), &fvalue,
1932 					NULL);
1933 	
1934 			svalue = planner_format_float (fvalue, 4, FALSE);
1935 			break;
1936 	
1937 		case MRP_PROPERTY_TYPE_DATE:
1938 			mrp_object_get (object,
1939 					mrp_property_get_name (property), &tvalue,
1940 					NULL); 
1941 			svalue = planner_format_date (tvalue);
1942 			break;
1943 			
1944 		case MRP_PROPERTY_TYPE_DURATION:
1945 			mrp_object_get (object,
1946 					mrp_property_get_name (property), &ivalue,
1947 					NULL); 
1948 	
1949 			svalue = planner_format_duration (PLANNER_TASK_TREE (data)->priv->project, ivalue);
1950 			break;
1951 			
1952 		case MRP_PROPERTY_TYPE_COST:
1953 			mrp_object_get (object,
1954 					mrp_property_get_name (property), &fvalue,
1955 					NULL); 
1956 	
1957 			svalue = planner_format_float (fvalue, 2, FALSE);
1958 			break;
1959 					

At conditional (1): "default" taking true path

1960 		default:
1961 			g_warning ("Type not implemented.");
1962 			break;
1963 		}
1964 	

Event uninit_arg: Using uninitialized value "svalue" as argument to function "g_object_set"
Also see events: [var_decl]

1965 		g_object_set (cell, "text", svalue, NULL);
1966 		g_free (svalue);
1967 	}


And it looks like the "same" bug is present for the value with the same name in the following places.

resource_view_property_data_func planner/src/planner-resource-view.c
mpp_property_value_data_func planner/src/planner-project-properties.c
mpp_project_property_get_value_string planner/src/planner-project-properties.c
Comment 1 Lincoln Phipps 2006-07-18 00:30:23 UTC
Created attachment 69080 [details] [review]
My first attempt at fixing these.

The patch contains fixes for all of bugzilla 334113, 334114, 334116 , 334117, 334121
Comment 2 Maurice van der Pot 2009-04-07 18:22:44 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.