PATCH: fix memoryleak
- From: Ali Akcaagac <ali akcaagac stud fh-wilhelmshaven de>
- To: balsa-list gnome org
- Subject: PATCH: fix memoryleak
- Date: Mon, 20 Aug 2001 12:31:27 +0200
hi,
here's a little fix for a memleak. affected file
src/store-address.c the patch is selfexplaining.
;------------------------------------------
middle_name = g_strconcat(middle_name, names[cnt2++], NULL);
;------------------------------------------
recursing concaternate creates new strings, so the old ones
wasnt free'd. since i don't like orphaned stuff, please
commit this one.
;------------------------------------------
carrier = middle_name;
middle_name = g_strconcat(middle_name, names[cnt2++], NULL);
g_free(carrier);
;------------------------------------------
this construction hopefully solves this.
--
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
--- /mnt/private/temp/cvstree/balsa/src/store-address.c Sun Aug 19 21:53:33 2001
+++ balsa/src/store-address.c Mon Aug 20 12:21:07 2001
@@ -70,6 +70,7 @@
gchar *first_name = NULL;
gchar *middle_name = NULL;
gchar *last_name = NULL;
+ gchar *carrier = NULL;
GtkWidget *ab_option, *menu_item, *ab_menu;
GList *ab_list;
LibBalsaAddressBook *address_book;
@@ -158,10 +159,15 @@
cnt2 = 1;
if (cnt > 2)
while (cnt2 != cnt - 1) {
+ carrier = middle_name;
middle_name = g_strconcat(middle_name, names[cnt2++], NULL);
+ g_free(carrier);
- if (cnt2 != cnt - 1)
+ if (cnt2 != cnt - 1) {
+ carrier = middle_name;
middle_name = g_strconcat(middle_name, " ", NULL);
+ g_free(carrier);
+ }
}
g_strfreev(names);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]