]> code.delx.au - pulseaudio/blobdiff - polyp/socket-util.c
introduce pa_xmalloc() and friends
[pulseaudio] / polyp / socket-util.c
index e0a3c28d2ab9e210b1a8bdb46667569f33ec6519..904381b7e6f5c5e5beca4c38120b4176001c60b5 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "socket-util.h"
 #include "util.h"
+#include "xmalloc.h"
 
 void pa_socket_peer_to_string(int fd, char *c, size_t l) {
     struct stat st;
@@ -179,8 +180,7 @@ int pa_unix_socket_remove_stale(const char *fn) {
 
 int pa_unix_socket_make_secure_dir(const char *fn) {
     int ret = -1;
-    char *slash, *dir = strdup(fn);
-    assert(dir);
+    char *slash, *dir = pa_xstrdup(fn);
     
     if (!(slash = strrchr(dir, '/')))
         goto finish;
@@ -192,14 +192,13 @@ int pa_unix_socket_make_secure_dir(const char *fn) {
     ret = 0;
     
 finish:
-    free(dir);
+    pa_xfree(dir);
     return ret;
 }
 
 int pa_unix_socket_remove_secure_dir(const char *fn) {
     int ret = -1;
-    char *slash, *dir = strdup(fn);
-    assert(dir);
+    char *slash, *dir = pa_xstrdup(fn);
     
     if (!(slash = strrchr(dir, '/')))
         goto finish;
@@ -211,6 +210,6 @@ int pa_unix_socket_remove_secure_dir(const char *fn) {
     ret = 0;
     
 finish:
-    free(dir);
+    pa_xfree(dir);
     return ret;
 }