[Xfce4-commits] r26076 - xarchiver/trunk/src
Giuseppe Torelli
colossus at xfce.org
Thu Sep 13 09:12:58 CEST 2007
Author: colossus
Date: 2007-09-13 07:12:58 +0000 (Thu, 13 Sep 2007)
New Revision: 26076
Modified:
xarchiver/trunk/src/extract_dialog.c
Log:
Fixed valgrind messages 'Invalid read/write of size x' in extract_dialog.c
Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c 2007-09-13 06:22:19 UTC (rev 26075)
+++ xarchiver/trunk/src/extract_dialog.c 2007-09-13 07:12:58 UTC (rev 26076)
@@ -68,21 +68,12 @@
gtk_widget_set_size_request (dialog_data->destination_path_entry, 385, -1);
gtk_entry_set_activates_default (GTK_ENTRY (dialog_data->destination_path_entry), TRUE);
- gchar *dummy = g_strrstr (archive->path, ".");
+ gchar *dummy = strstr(archive->path, ".");
if (dummy != NULL)
{
dummy++;
unsigned short int x = strlen (archive->path) - strlen ( dummy );
- gchar *extraction_string = (gchar *) g_malloc ( x + 1);
- strncpy ( extraction_string, archive->path, x );
- extraction_string [x-1] = '\0';
-
- if (strstr (extraction_string,".tar"))
- {
- extraction_string = g_realloc (extraction_string, x - 5);
- strncpy ( extraction_string, archive->path, x - 5);
- extraction_string[x-5] = '\0';
- }
+ gchar *extraction_string = g_strndup(archive->path,x-1);
gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry), extraction_string);
g_free (extraction_string);
}
More information about the Xfce4-commits
mailing list