DragonFly bugs List (threaded) for 2004-10
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: cu coredumps
Timour Ezeev wrote:
I think you got small memory leak there IMHO (either tmp_cp is not used
but allocated or cp is lost).
I think I see what you mean with the tmp_cp allocated but not used. I
don't think I get you on the cp is lost part though. Is the attached better?
Also, where would I put the free() exactly? I forgot about that..
--
Internet Explorer? Try FireFox at http://www.mozilla.org/products/firefox/
Outlook Express? Try ThunderBird at
http://www.mozilla.org/products/thunderbird/
--- hunt.c.old 2004-10-27 16:44:06.000000000 +0100
+++ hunt.c 2004-10-27 17:40:20.000000000 +0100
@@ -58,17 +58,31 @@
hunt(name)
char *name;
{
- register char *cp;
+ register char *cp, *tmp_cp;
sig_t f;
- int res;
+ int res, cp_len = 0;
f = signal(SIGALRM, dead);
while ((cp = getremote(name))) {
deadfl = 0;
- if ((uucplock = strrchr(cp, '/')) == NULL)
- uucplock = cp;
- else
+
+ if ((uucplock = strrchr(cp, '/')) == NULL) {
+ cp_len = strlen(cp) + strlen("/dev/") + 1;
+ tmp_cp = malloc(sizeof(char) * cp_len);
+
+ strncpy(tmp_cp, "/dev/", 6);
+ strncat(tmp_cp, cp, strlen(cp));
+
+ if ((uucplock = strrchr(tmp_cp, '/')) == NULL) {
+ uucplock = cp;
+ } else {
+ cp = tmp_cp;
+ ++uucplock;
+ }
+ } else {
++uucplock;
+ }
+
if ((res = uu_lock(uucplock)) != UU_LOCK_OK) {
if (res != UU_LOCK_INUSE)
fprintf(stderr, "uu_lock: %s\n", uu_lockerr(res));
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]