aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-02-10 16:29:50 +0000
committerFrederic Culot <calcurse@culot.org>2008-02-10 16:29:50 +0000
commit52340fa0e132766e9a0d1e5a95d45282725cdf97 (patch)
treea54b7b3410ba13453c87f0a1efeb7923839c740d
parent886466310798ee9d63191cff05d57c4e9528b32e (diff)
downloadcalcurse-52340fa0e132766e9a0d1e5a95d45282725cdf97.tar.gz
calcurse-52340fa0e132766e9a0d1e5a95d45282725cdf97.zip
memory leak fixed in notify_thread_app()
check for limits.h header added asprintf() call replaced in wins_launch_external() as it is not fully portable
-rwxr-xr-xChangeLog4
-rwxr-xr-xconfigure.ac4
-rwxr-xr-xsrc/notify.c5
-rwxr-xr-xsrc/utils.c3
-rwxr-xr-xsrc/wins.c13
5 files changed, 21 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 07cf434..37f0ef4 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
10 Feb 2008:
manuals updated to make use of css style sheet
+ memory leak fixed in notify_thread_app()
+ check for limits.h header added
+ asprintf() call replaced in wins_launch_external() as it is not
+ fully portable
03 Feb 2008:
doc/manual.css added
diff --git a/configure.ac b/configure.ac
index 97f3552..e65edad 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $calcurse: configure.ac,v 1.14 2008/01/26 10:02:01 culot Exp $
+# $calcurse: configure.ac,v 1.15 2008/02/10 16:29:50 culot Exp $
#-------------------------------------------------------------------------------
# Init
@@ -23,7 +23,7 @@ AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h getopt.h locale.h math.h signal.h stdbool.h stdio.h \
stdlib.h string.h sys/stat.h sys/types.h sys/wait.h time.h \
- unistd.h errno.h])
+ unistd.h errno.h limits.h])
#-------------------------------------------------------------------------------
# Checks for system libs
#-------------------------------------------------------------------------------
diff --git a/src/notify.c b/src/notify.c
index 3531a02..0befe8b 100755
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,4 +1,4 @@
-/* $calcurse: notify.c,v 1.23 2007/12/30 16:27:59 culot Exp $ */
+/* $calcurse: notify.c,v 1.24 2008/02/10 16:29:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -278,6 +278,7 @@ notify_thread_app(void *arg)
tmp_app = (struct notify_app_s *) malloc(sizeof(struct notify_app_s));
tmp_app->time = current_time + DAYINSEC;
tmp_app->got_app = 0;
+ tmp_app->txt = NULL;
tmp_app = recur_apoint_check_next(tmp_app, current_time, get_today());
tmp_app = apoint_check_next(tmp_app, current_time);
@@ -292,6 +293,8 @@ notify_thread_app(void *arg)
}
pthread_mutex_unlock(&notify_app->mutex);
+ if (tmp_app->txt != NULL)
+ free(tmp_app->txt);
free(tmp_app);
notify_update_bar();
diff --git a/src/utils.c b/src/utils.c
index bad5d88..6cdc246 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.41 2008/01/20 10:45:39 culot Exp $ */
+/* $calcurse: utils.c,v 1.42 2008/02/10 16:29:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -27,6 +27,7 @@
#include <time.h>
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
diff --git a/src/wins.c b/src/wins.c
index fe79588..302bb04 100755
--- a/src/wins.c
+++ b/src/wins.c
@@ -1,4 +1,4 @@
-/* $Id: wins.c,v 1.9 2007/12/30 16:27:59 culot Exp $ */
+/* $Id: wins.c,v 1.10 2008/02/10 16:29:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -25,6 +25,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include "i18n.h"
#include "notify.h"
@@ -371,10 +372,14 @@ void
wins_launch_external(const char *file, const char *cmd)
{
char *p;
-
- if (asprintf(&p, "%s %s", cmd, file) == -1)
- return;
+ int len;
+ len = strlen(file) + strlen(cmd) + 1;
+ p = (char *)malloc(sizeof(char) * len);
+ if (snprintf(p, len, "%s %s", cmd, file) == -1) {
+ free(p);
+ return;
+ }
if (notify_bar())
notify_stop_main_thread();
def_prog_mode();