mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
..and removed the rest of the alloca()s too
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@918 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
32790f1515
commit
cfd50ce9cd
4 changed files with 21 additions and 25 deletions
|
|
@ -10,10 +10,6 @@
|
|||
#include <libc.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include "findme.h"
|
||||
|
||||
char * findProgramPath(char * argv0) {
|
||||
|
|
@ -29,9 +25,8 @@ char * findProgramPath(char * argv0) {
|
|||
|
||||
if (!path) return NULL;
|
||||
|
||||
start = pathbuf = alloca(strlen(path) + 1);
|
||||
buf = malloc(strlen(path) + strlen(argv0) + 2);
|
||||
strcpy(pathbuf, path);
|
||||
start = pathbuf = g_strdup(path);
|
||||
buf = g_malloc(strlen(path) + strlen(argv0) + 2);
|
||||
|
||||
chptr = NULL;
|
||||
do {
|
||||
|
|
@ -40,8 +35,10 @@ char * findProgramPath(char * argv0) {
|
|||
sprintf(buf, "%s/%s", start, argv0);
|
||||
|
||||
#ifndef WIN32
|
||||
if (!access(buf, X_OK))
|
||||
if (!access(buf, X_OK)) {
|
||||
g_free(pathbuf);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (chptr)
|
||||
|
|
@ -50,6 +47,7 @@ char * findProgramPath(char * argv0) {
|
|||
start = NULL;
|
||||
} while (start && *start);
|
||||
|
||||
g_free(pathbuf);
|
||||
free(buf);
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue