]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fixed va_end usage
authorArvin Schnell <aschnell@suse.de>
Thu, 15 Nov 2012 10:18:20 +0000 (11:18 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 15 Nov 2012 10:18:20 +0000 (11:18 +0100)
snapper/AppUtil.cc

index f5d7a4d7e044851422f7ca54b78d6fa55181db7a..8a786dcb375a837c329c85df07b9aae8c21f1345 100644 (file)
@@ -217,15 +217,17 @@ namespace snapper
     sformat(const string& format, ...)
     {
        char* result;
+       string str;
 
        va_list ap;
        va_start(ap, format);
-       if (vasprintf(&result, format.c_str(), ap) == -1)
-           return string();
+       if (vasprintf(&result, format.c_str(), ap) != -1)
+       {
+           str = result;
+           free(result);
+       }
        va_end(ap);
 
-       string str(result);
-       free(result);
        return str;
     }