X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fportab%2Fportabtest.c;h=5ad37b99ca3a4effb6524e0b8ed00e4514bbc425;hp=d7f33f99701feaec7de9da8f5aad0ea2098a4e06;hb=8d173a33286f47ac5678a8ce8cdd756295342cb1;hpb=259c314d142abd6f9295047c116235cfdd119563 diff --git a/src/portab/portabtest.c b/src/portab/portabtest.c index d7f33f99..5ad37b99 100644 --- a/src/portab/portabtest.c +++ b/src/portab/portabtest.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -104,9 +104,10 @@ Check_strlcat(void) static void Check_strtok_r(void) { - char *ptr, *last; + char *str, *ptr, *last; ptr = strdup("12,abc"); + str = ptr; ptr = strtok_r(ptr, ",", &last); if (!ptr) @@ -123,6 +124,8 @@ Check_strtok_r(void) ptr = strtok_r(NULL, ",", &last); if (ptr) Panic("strtok_r result #3"); + + free(str); } #ifdef PROTOTYPES @@ -196,7 +199,7 @@ main(void) Check_strlcat(); Check_strtok_r(); Check_vsnprintf(2+10, "%s%s", "ab", "1234567890"); - + return 0; }