anjuta r3464 - in trunk: . libanjuta



Author: sgranjoux
Date: Sun Jan 13 14:56:40 2008
New Revision: 3464
URL: http://svn.gnome.org/viewvc/anjuta?rev=3464&view=rev

Log:
	* libanjuta/anjuta-utils.c:
	anjuta_util_get_real_path return a string that need to be freed
	with g_free even if PATH_MAX is not defined


Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-utils.c

Modified: trunk/libanjuta/anjuta-utils.c
==============================================================================
--- trunk/libanjuta/anjuta-utils.c	(original)
+++ trunk/libanjuta/anjuta-utils.c	Sun Jan 13 14:56:40 2008
@@ -596,8 +596,8 @@
 {
 	if (path != NULL)
 	{
-#ifdef PATH_MAX
 		gchar *result;
+#ifdef PATH_MAX
 		gchar buf[PATH_MAX+1];
 
 		result = realpath (path, buf);
@@ -607,9 +607,16 @@
 			return g_strdup (buf);
 		}
 #else
-		/* strictly, the string returned from this should be cleaned with
+		char *buf;
+		/* the string returned by realpath should be cleaned with
 		   free(), not g_free() */
-		return (realpath (path, NULL));
+		buf = realpath (path, NULL);
+		if (buf != NULL)
+		{
+			result = g_strdup (buf);
+			free (buf);
+			return result;
+		}
 #endif
 	}
 	return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]