]> git.deb.at Git - pkg/abook.git/blobdiff - abook.c
- add xstrdup to have proper checking for memory allocation failures
[pkg/abook.git] / abook.c
diff --git a/abook.c b/abook.c
index c754499260281e02a0dd4302797b2d10769b87fc..557ddb2f5818f7a4c5f9c8d855278aa8dc418747 100644 (file)
--- a/abook.c
+++ b/abook.c
@@ -105,7 +105,7 @@ xmalloc_error_handler(int err)
 {
        /*
         * We don't try to save addressbook here because we don't know
-        * if it's fully loaded to to memory.
+        * if it's fully loaded to memory.
         */
        if(is_ui_initialized())
                close_ui();
@@ -259,7 +259,7 @@ set_filename(char **var, char *path)
        assert(path != NULL);
 
        if(*path == '/') {
-               *var = strdup(path);
+               *var = xstrdup(path);
                return;
        }
 
@@ -503,7 +503,7 @@ make_mailstr(int item)
 
        ret = *database[item][EMAIL] ?
                mkstr("%s <%s>", name, email) :
-               strdup(name);
+               xstrdup(name);
 
        free(name);
 
@@ -745,8 +745,8 @@ add_email_add_item(int quiet, char *name, char *email)
        }
 
        memset(item, 0, sizeof(item));
-       item[NAME] = strdup(name);
-       item[EMAIL] = strdup(email);
+       item[NAME] = xstrdup(name);
+       item[EMAIL] = xstrdup(email);
        add_item2database(item);
 
        return 1;