about summary refs log tree commit diff stats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common.c b/src/common.c
index 6defa7c1..eca444e6 100644
--- a/src/common.c
+++ b/src/common.c
@@ -34,8 +34,6 @@
  *
  */
 
-#define _GNU_SOURCE 1
-
 #include "config.h"
 
 #include <errno.h>
@@ -529,13 +527,14 @@ _unique_filename(const char* filename)
 
     unsigned int i = 0;
     while (g_file_test(unique, G_FILE_TEST_EXISTS)) {
-        free(unique);
+        g_free(unique);
 
         if (i > 1000) { // Give up after 1000 attempts.
             return NULL;
         }
 
-        if (asprintf(&unique, "%s.%u", filename, i) < 0) {
+        unique = g_strdup_printf("%s.%u", filename, i);
+        if (!unique) {
             return NULL;
         }