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
This commit is contained in:
Frederic Culot 2008-02-10 16:29:50 +00:00
parent 8864663107
commit 52340fa0e1
5 changed files with 21 additions and 8 deletions

View File

@ -1,5 +1,9 @@
10 Feb 2008: 10 Feb 2008:
manuals updated to make use of css style sheet 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: 03 Feb 2008:
doc/manual.css added doc/manual.css added

View File

@ -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 # Init
@ -23,7 +23,7 @@ AC_PROG_CC
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h getopt.h locale.h math.h signal.h stdbool.h stdio.h \ 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 \ 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 # Checks for system libs
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -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 * 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 = (struct notify_app_s *) malloc(sizeof(struct notify_app_s));
tmp_app->time = current_time + DAYINSEC; tmp_app->time = current_time + DAYINSEC;
tmp_app->got_app = 0; tmp_app->got_app = 0;
tmp_app->txt = NULL;
tmp_app = recur_apoint_check_next(tmp_app, current_time, get_today()); tmp_app = recur_apoint_check_next(tmp_app, current_time, get_today());
tmp_app = apoint_check_next(tmp_app, current_time); tmp_app = apoint_check_next(tmp_app, current_time);
@ -292,6 +293,8 @@ notify_thread_app(void *arg)
} }
pthread_mutex_unlock(&notify_app->mutex); pthread_mutex_unlock(&notify_app->mutex);
if (tmp_app->txt != NULL)
free(tmp_app->txt);
free(tmp_app); free(tmp_app);
notify_update_bar(); notify_update_bar();

View File

@ -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 * Calcurse - text-based organizer
@ -27,6 +27,7 @@
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>

View File

@ -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 * Calcurse - text-based organizer
@ -25,6 +25,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "i18n.h" #include "i18n.h"
#include "notify.h" #include "notify.h"
@ -371,10 +372,14 @@ void
wins_launch_external(const char *file, const char *cmd) wins_launch_external(const char *file, const char *cmd)
{ {
char *p; char *p;
int len;
if (asprintf(&p, "%s %s", cmd, file) == -1) len = strlen(file) + strlen(cmd) + 1;
p = (char *)malloc(sizeof(char) * len);
if (snprintf(p, len, "%s %s", cmd, file) == -1) {
free(p);
return; return;
}
if (notify_bar()) if (notify_bar())
notify_stop_main_thread(); notify_stop_main_thread();
def_prog_mode(); def_prog_mode();