summaryrefslogtreecommitdiff
path: root/legacy/efreet/src/lib/efreet_desktop_command.c
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2010-08-02 20:43:09 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2010-08-02 20:43:09 +0000
commit4b221c3936fa597ca97d60822bf305526f5f9c4f (patch)
treeb4512b9dbf5853073debd2f9aeb9e69e13012ffb /legacy/efreet/src/lib/efreet_desktop_command.c
parentbec24bf71fa98cde767186c7779b746abe6ecacc (diff)
Check return value for realloc
SVN revision: 50753
Diffstat (limited to '')
-rw-r--r--legacy/efreet/src/lib/efreet_desktop_command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/legacy/efreet/src/lib/efreet_desktop_command.c b/legacy/efreet/src/lib/efreet_desktop_command.c
index d71f78ffe7..ce0af26d14 100644
--- a/legacy/efreet/src/lib/efreet_desktop_command.c
+++ b/legacy/efreet/src/lib/efreet_desktop_command.c
@@ -378,6 +378,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
378 { 378 {
379 size = len + 1024; 379 size = len + 1024;
380 exec = realloc(exec, size); 380 exec = realloc(exec, size);
381 if (!exec) goto error;
381 } 382 }
382 383
383 /* XXX handle fields inside quotes? */ 384 /* XXX handle fields inside quotes? */
@@ -458,6 +459,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
458 { 459 {
459 size = len + 1024; 460 size = len + 1024;
460 exec = realloc(exec, size); 461 exec = realloc(exec, size);
462 if (!exec) goto error;
461 } 463 }
462 exec[len++] = ' '; 464 exec[len++] = ' ';
463 exec = efreet_desktop_command_append_multiple(exec, &size, 465 exec = efreet_desktop_command_append_multiple(exec, &size,
@@ -476,6 +478,13 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
476 while ((l = eina_list_next(l)) != NULL); 478 while ((l = eina_list_next(l)) != NULL);
477 479
478 return execs; 480 return execs;
481error:
482 if (execs)
483 {
484 EINA_LIST_FREE(execs, exec)
485 free(exec);
486 }
487 return NULL;
479} 488}
480 489
481static void 490static void
@@ -836,6 +845,7 @@ efreet_string_append(char *dest, int *size, int *len, const char *src)
836 *len = *size - 1; 845 *len = *size - 1;
837 *size += 1024; 846 *size += 1024;
838 dest = realloc(dest, *size); 847 dest = realloc(dest, *size);
848 if (!dest) return NULL;
839 *(dest + *len) = '\0'; 849 *(dest + *len) = '\0';
840 850
841 l = eina_strlcpy(dest + *len, src + off, *size - *len); 851 l = eina_strlcpy(dest + *len, src + off, *size - *len);
@@ -852,6 +862,7 @@ efreet_string_append_char(char *dest, int *size, int *len, char c)
852 { 862 {
853 *size += 1024; 863 *size += 1024;
854 dest = realloc(dest, *size); 864 dest = realloc(dest, *size);
865 if (!dest) return NULL;
855 } 866 }
856 867
857 dest[(*len)++] = c; 868 dest[(*len)++] = c;